Skeletonkey

Latest version: v0.2.12

Safety actively analyzes 623642 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.2.12

---
A new method has been introduced in the Config class that enables users to update the keys of a configuration object while the program is running. Users can pass a dictionary or another configuration object, using dot notation, to update the values of an existing Config object. This functionality is particularly useful in scenarios involving frameworks like Weights and Biases, where dynamic adjustments to the configuration might be necessary during experiments or model training.

Additionally, a problem was resolved that previously prevented users from changing the data type of values associated with keys in a configuration directly from the command line.

0.2.11

Features
- **Config Namespace Instantiation**: Introduced a new `instantiate` method in the Config namespace object, enabling users to instantiate objects in several intuitive ways:
- Utilizing the SkeletonKey framework directly:
python
model = skeletonkey.instantiate(args.model, arg1=arg1, arg2=arg2, arg3=arg3)

- Via the model's instantiation method:
python
model = args.model.instantiate(arg1=arg1, arg2=arg2, arg3=arg3)

- Through direct Config object calls:
python
model = args.model(arg1=arg1, arg2=arg2, arg3=arg3)

This addition aims to simplify and diversify the object creation process within the framework.

Enhancements
- **Project File Structure Rework**: The entire project’s file structure has been reorganized to support the new instantiation methods and to avoid issues with circular imports, enhancing the code’s modularity and maintainability.
- **Fetch Functionality**: Added new `fetch` functionality along with an example case that serves as a basic test, demonstrating the integration of remote resources or configurations seamlessly into the project.

Changes
- **Renaming of `import_class` to `import_target`**: To better reflect its expanded role in importing both classes and other targets required by the `instantiate` and `fetch` methods, `import_class` has been renamed to `import_target`.
- **Command Line Config Overrides**: The command line interface has been enhanced to allow users to directly override the main configuration, providing greater flexibility in configuration management during runtime.
- **Type Annotation Adjustments**: The explicit type annotations for the Config object in the `instantiate` method have been removed to accommodate the restructured instantiation approach. A shared Config interface is suggested as a potential solution for maintaining type checking and annotations integrity.

0.2.10

Features
- **Recursive Initialization:** Enhanced the instantiation process to support recursive initialization. Now, if any of the values in the Config being instantiated are themselves Configs containing the `target` keyword, those sub-configs will also be instantiated. This allows for sub-targets to be used as arguments for other objects during initialization. An example case demonstrating this behavior has been included, serving as a basic test case.

Enhancements
- **Custom Namespace Class:** Introduced a new custom `Namespace` class in `configs.py`, which is similar to `argparse.Namespace` but includes `__getitem__`, `__setitem__`, and `__str__` methods. This class also supports hierarchical formatting of nested namespaces, essentially in YAML format.

Changes
- **Replacement of `argparse.Namespace`:** All references to `argparse.Namespace` have been replaced with the custom `Namespace` class provided by SkeletonKey.
- **Refactoring of Keywords:** Some of the keywords have been extracted as constants at the top of the file for better clarity and maintainability. This change was intended to be a separate pull request but was included due to a mix-up in the git history.

0.2.0

New Features

1. **Defining Flags in Configuration:**
- Flags can be defined in the configuration YAML using the `?` prefix.
- Command-line arguments can be used to override flags.

2. **Using Modular Subconfigurations (`keyring` feature):**
- Modularize configurations using subconfigurations.
- Define a `keyring` section in the main configuration file to reference various subconfigurations from separate files.

3. **Integration of Environment Variables in Configuration:**
- Incorporate environment variables in the configuration YAML using the `$` prefix.
- Enables users to store sensitive information outside the configuration file.

0.0.11

Provides a decorator and a function to simplify the management of complex configurations for applications using YAML files. The key features include:

- unlock decorator: It parses and injects configuration arguments into a main function from a YAML file. Given the name of the configuration file and an optional path to the directory containing the file, this decorator reads the configuration, creates an argument parser, and adds the arguments from the configuration to the parser. The arguments are then passed to the decorated main function.

- instantiate function: It instantiates a class object using a dictionary of keyword arguments. The dictionary should contain the keys "kwargs" and "target" to specify the class to instantiate and its arguments. This function is useful for dynamically creating class instances with their configurations at runtime.

By using this tool, you can easily manage complex configurations for your applications and dynamically load classes and their arguments at runtime.

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.