Dclick
Extend click functionnalities by allowing parameters to be passed in a config file.
Free software: BSD license
Features
Implement a new decorator ‘command_with_config’ which enables to pass default values for click options in a config file
Performs the same checks as click regarding values passed in config file (ex: check if path exists)
Seamless integration with click, just replace click.command with dclick.command_with_config
With click you would have to pass a default value directly in the code
from click import command
from click import option
@command()
@option('-n', '--n-epochs', type=int, default=5, help='Number of epochs to train the model')
def train(n_epochs):
run_training_for(n_epochs)
if __name__ == '__main__':
train()
However, if you want to run this code with different parameters you would have to edit the code each time or pass them in the command line. Both these solutions are not satisfying for automation and versioning. Imagine that you want to run your code inside a docker without the possibility to use the command line, like you are working with a managed platform on the cloud. With dclick you just have to change one line:
from dclick import command_with_config
from click import option
@command_with_config('path_to_config.json')
@option('-n', '--n-epochs', type=int)
def train(n_epochs):
run_training_for(n_epochs):
if __name__ == '__main__':
train()
Just be careful that the name in the config matches the name of the option. dclick takes care of the rest. You can pass a config as json, yaml or txt. Json and yaml are preferred.
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2020-06-23)
First release on PyPI.
Metadata
Release files for dclick 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dclick-0.1.3.tar.gz | 13.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dclick-0.1.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 20.0 kB
Release files / dclick-0.1.3.tar.gz
| Download URL | dclick-0.1.3.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9cc6ddd7c6ab7f327a46247c72e71d11e766c0a7bec74815522b6914634df23
|
|
BLAKE2b-256 checksum How to use checksums |
a0f6dd63c8ee50c50a580d53f6fbbc8f8795b5c1ce6721d4eabcfbc56feaece1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.8.0 tqdm/4.54.0 CPython/3.8.3
|
Release files / dclick-0.1.3-py2.py3-none-any.whl
| Download URL | dclick-0.1.3-py2.py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
542eea14b941cea5b0b70bd2a940a943a1adf4376fdd5eac2f9efce346279d1d
|
|
BLAKE2b-256 checksum How to use checksums |
38199e2f6fae0bd51b6520d5251e9b80c17043ac3cfd5c22c153991f9b8201b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.8.0 tqdm/4.54.0 CPython/3.8.3
|
Security for dclick 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.