Skip to main content

Dataclass command line interface

Project description

Dataclass Command-line Interface

Code style: black image

Installation

From pip:

pip install dc-cli

Usage

from dataclasses import dataclass, fields
import dataclass_cli

@dataclass_cli.add
@dataclass
class Model:
    num_layers: int
    learning_rate: float
    training: bool

model = Model()
print(model)

Output:

 python test.py --help
usage: test.py [-h] --model_num_layers MODEL_NUM_LAYERS --model_learning_rate MODEL_LEARNING_RATE (--model_training | --no-model_training)

optional arguments:
  -h, --help            show this help message and exit

model:
  --model_num_layers MODEL_NUM_LAYERS
  --model_learning_rate MODEL_LEARNING_RATE
  --model_training
  --no-model_training
❯ python test.py --model_num_layers 10 --model_learning_rate 0.1 --no-model_training
Model(num_layers=10, learning_rate=0.1, training=False)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dc-cli-0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

dc_cli-0.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file dc-cli-0.1.tar.gz.

File metadata

  • Download URL: dc-cli-0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for dc-cli-0.1.tar.gz
Algorithm Hash digest
SHA256 a66f3f1eee9ea0dc507b160c3ce97c273d4a6d8ba6002f06901460758d20a0e4
MD5 967212110b5bf093a94b4e13c7345abd
BLAKE2b-256 19b5b35264b1b536edb3227b35cc93507eb7bae4a1f27e98b655bfb5f74ee04c

See more details on using hashes here.

File details

Details for the file dc_cli-0.1-py3-none-any.whl.

File metadata

  • Download URL: dc_cli-0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for dc_cli-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4d33a0605143eb9ac63a044f9f90c4a12abab681d887a8db4017fd4952c20d12
MD5 28452b7d2655545f0e7c15a0824f68f4
BLAKE2b-256 d17908e157da001e502a6f0bcf08074e5d287e49a56843625831ee6017f9b577

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page