Skip to main content

Dclick

https://img.shields.io/pypi/v/dclick.svg https://circleci.com/gh/AnOtterGithubUser/double_click.svg?style=shield

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.

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)

Source distribution for dclick 0.1.3
File Size Uploaded
dclick-0.1.3.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dclick 0.1.3
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page