Releases: data-ductus/varvault
Release list
6.0.2 - Bug fixes to automatic
6.0.1 - Bugfixes
Changes:
- There was a bug when annotating functions with
automaticwhile the key(s) are already in the vault. The change will aim to only dispatch the function that is annotated rather than all functions, since that is what is desired anyway. - Lowered the logging level for some messages related to threaded automatics from INFO to DEBUG.
6.0.0 - New major version
Changes:
- Renamed
vaultertomanualsince "vaulter" isn't a real word and "manual" describes it better since it's called manually. - Renamed
input_keystoinput, and renamedreturn_keystooutput. - Added a big new feature which is a new form of decorator:
automatic. This decorator works pretty much the same asmanualdoes, but will trigger automatically when all input keys exist in the vault and can be viewed as a subscriber. This means that no manual execution of the decorated function is necessary. A subscriber can also run in a thread if you want, meaning you can easily run things in parallel when the conditions are met and just let things happen when they can happen. You can define a conditional for functions defined asautomatic. A conditional is meant to be a lambda that takes 0 arguments that checks something that evaluates to True. You can use this to, for example, check if a string value in the vault matches something. - Added a new flag called
output_key_replaces_input_keyand it works as you might expect. Amanualorautomaticdecorated function with 1 input key and 1 output key with this flag will delete the input key from the vault and insert the output key, meaning the input key will be gone from the vault and effectively replaced by the new key (or at least that's the idea). This can be useful when creating a datastructure that isn't final, but you still want to useautomaticand trigger on this structure once it's created. With this key you can have intermediate keys before the final one.
5.0.2 - Bugfixes
Bugfixes:
- Correctly type-annotated the return variable for
VarVault.getwhen getting the variable for a single key to beAnyinstead ofobject
5.0.1 - Bugfixes
- Made some fixes to
Vault.getto use the@overloaddecorator so IDEs doesn't get confused with what implementations are available. - Made a fix for when using validators and modifiers together when adding values to the vault using
insert. In this case, it would validate without modifying the value. It would also validate the value twice, which shouldn't be necessary. It does mean thatMiniVault.builddoesn't validate the keys, but that's fine because you still cannot write a faulty value for key to the vault.
5.0.0 - New major release
Made a ton of changes to the APIs and some new functionality:
- Reworked how resources function. They now use the same mode as the builtin open function does. You can set modes like "r", "w", "a", "r+", "w+", and "a+". They will work as you expect, with the difference that those with a + indicates live-update is enabled, e.g. "r" is read mode, while "r+" is read with live-update enabled.
- The standard JsonResource has been changed to create a backup file that is written to. After the backup file has been written to, the name of the file will be changed to the normal file. This way, there's always a file to read from. In very rare cases, if you kill the writing process, there will not be anything in the file since the file is opened in "w" mode, since append mode works really badly with JSON. We might lose a bit of data in such a case, but we retain most of it since we'll read from the standard file that still exists.
- A Key can now take a set of modifier functions. These work just like validators (see validator.py) in that you create a method to annotate with varvault.modifier() which will allow you to modify the value of the object mapped to the key. This is useful if you want to strip a sequence of characters from a string, or expand vars/user in a path, or to always follow symlinks using os.path.realpath. This can reduce some boilerplate code.
- The VaultFlags have been changed to just Flags and they have been changed to enums which is quite a bit more lightweight than creating new strings for every key.
- The factory functions have been completely changed. There is now only create, and no from_vault. The resource object will handle the from_vault case by using append mode (mores "a", or "a+") instead.
- There's no argument for resource_from or resource_to anymore; just resource. If you want to load a vault from one resource and write to another resource, you'll need to create a resource-object for the resource that you want to load from and load it into the vault manually after creating the vault.
- A function has been added to utils called assert_and_raise. The function takes a condition as a bool and an exception object. It acts as an assert-function that can raise any exception you want (such as KeyError or ValueError) rather than AssertionError.
- Internal logging has been changed to be more robust, though this sadly means it's a bit slower. It's not slow, just slower than it was. But the robustness improvements are worth it to get the logging you expect.
- Added more type-annotations to exposed functions, such as for create under factory.py. This should help users to know how to use the functions better, provided they are using a proper IDE.
4.1.0 - Bugfixes and tracking of key usages in decorated functions
Made some bugfixes related to resources, where creating a resource that had a relative path to the same directory was not working. It was also not possible to create a vault without supplying a resource which it absolutely should be possible to do.
Added new functionality to keys, where the usage of a certain key is logged in the key itself. It only logs usage in functions decorated with vaulter for now, but it can be quite helpful when you need to understand why a key is missing in the vault, or if you just want to know where a certain key is used if you are working on a big project.
4.0.1 - Bugfixes for live-update and vault-structs
Fixed a bug related to live-update and vault-structs which meant that specialized keys would not be reloaded as the correct key type. Added a test for this. Also made some fixes to how the state for a resource is handled. Simplified create_mv_from_resource to just take the expected keys as an argument.
4.0.0 - New major version
New features:
- Added the possibility to define input keys through the name of the parameters in the signature of the function. It essentially comes down to calling a parameter the same as the name of a key in the keyring and making sure the flag
VaultFlags.use_signature_for_input_keysis defined. This can reduce boilerplate, but does make it harder to track the usage of certain keys, which is why it will never be the default behavior of varvault.
Other changes:
- Updated the conclusion section of the README.md.
- Reworked the filehandlers API and simplified the JsonFileHandler slightly.
- The filehandler now holds the state and keeps track of it, rather than varvault itself keeping track of the state.
- Made changes to the vaultstructs API to change the name of the abstract method to
createwhich is a lot less cumbersome of a function name. - Made significant cleanup of code, mostly in vault.py to make it easier to work with, and to read and comprehend.
- Renamed filehandler.py to resource.py as that is more what it is than a filehandler, even if that will most likely be what it will be used for.
3.1.0 - Bugfixes for live-update and filehandlers and some API additions
Made bugfixes for both live-update and filehandlers, which prompted some expansion to the API for the builtin JsonFileHandler:
Added a new flag create_file_on_live_update to the JsonFileHandler which essentially creates the file when creating a filehandler that is meant to work with live-update because sometimes you want to create a new vault that is meant to fetch live-update changes later.