tfeldmann/organize

What's coming in organize v3.

tfeldmann opened this issue · 0 comments

Organize v3 is in the works and is coming together really well. This is what is planned for the 3.0 release:

Use pydantic for config file parsing.

This results in much nicer error messages in case something is wrong in your configuration. It should also improve startup times and overall code readability. Pretty much everything now has type hints and uses well-defined data structures instead of muddy balls of **kwargs.

Configuration in Python

You will be able to use Organize from within Python scripts. YAML will still be fine for basic configurations, but sometimes you just need the power of a real programming language where you can combine things to your liking.

It will look like this:

from organize import Config, Rule
from organize.filters import Extension, Size
from organize.actions import Echo

my_rule = Rule(
    locations="some/path",
    filters=(
        Extension(".txt"),
        Size(),
    ),
    actions=(
        Echo("File {path} has size: {size}."),
    )
)

Config(rules=[my_rule]).execute(simulate=False)

Remove pyfilesystem.

The move to pyfilesystem was one of the bigger changes in v2. In hindsight, the library wasn't really fit for the purpose. It's still a great library to do some basic file system operations in local, memory, and remote filesystems, but it's missing some crucial functionality like checking whether two resources are pointing to the same file on disk. I even submitted some PRs fixing performance and robustness problems, but it just doesn't feel right with Organize and makes everything a lot more complex.

I thought long and hard about this, and I think this is the right way to go. Starting with v3, Organize will only use os, pathlib and shutils for all file handling. This means all remote filesystem functionality will be removed. If you depend on this, feel free to stay on v2 or use v3 and mount the remote filesystem to the local machine.

JSON Output.

v3 will support JSONL output, meaning one JSON object per line. The output module has been completely refactored. It would even be possible to create a GUI for this ;) Additional output formats are planned and should be easy to implement now.

Other improvements.

Lots of new tests. Easier testing thanks to pyfakefs. A filter and action registry so you can easily plug in your custom filters and actions. And many more.

TL;DR: V3 will remove features, clean up the codebase, be faster, and more robust.