configutator
Maps yaml nodes and command line arguments to python function parameters.
To install: pip install configutator Or:
git clone git@github.com:innovate-invent/configutator.git cd configutator python3 setup.py install
To use:
Create a main function with all the parameters you need, annotated with any defaults.
Use the @ConfigMap and @ArgMap decorators to modify the default mappings if needed.
In the if __name__ == "__main__": block at the bottom of the file call the loadConfig() function.
Here is an example of the most basic use:
from configutator import loadConfig
from sys import argv
def foo(param1, param2, param3=None):
pass
if __name__ == "__main__":
for argmap in loadConfig(argv, (foo,)):
foo(**argmap[foo])
One thing you need to keep in mind when working with configutator is that the config, command line arguments, and function parameters are all independant. The parameters given to @ConfigMap and @ArgMap are what connects them all. You should never have to change a function signature to modify the command line functionality.
Metadata
Release files for configutator 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| configutator-1.0.2.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| configutator-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.5 kB
Release files / configutator-1.0.2.tar.gz
| Download URL | configutator-1.0.2.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cceb70538c1f1e155942948065597398aab4868c29946e20cfb0f61ad99ecffe
|
|
BLAKE2b-256 checksum How to use checksums |
52d05f5388cf60f09071499a7b19878297462d230c4bee8bb9ea8177c083e537
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / configutator-1.0.2-py3-none-any.whl
| Download URL | configutator-1.0.2-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b46f107455d33e7f4ba6b820b5f04651706826891d85f8db2038e31d3bdc294
|
|
BLAKE2b-256 checksum How to use checksums |
c5aff45b1d050c870206b2b9abd6a3407da3d586be16f5a0e8faa09d8adbf59c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |