Skip to main content

ci python-version pypi

Argdcls

A simple tool to use dataclass as your config.

Usage

from dataclasses import dataclass

import argdcls


@dataclass
class Config:
    lr: float
    adam: bool = False


config = argdcls.load(Config)
print(config)
$ python3 main.py @lr=1.0
Config(lr=1.0, adam=False)
$ python3 main.py lr=1.0 adam=True
Config(lr=1.0, adam=True)
$ python3 main.py lr=1.0 adm=True # typo!
Parameter \"adm\" is not in the dataclass fields: ['lr', 'adam'].
$ python3 main.py lr=1.0 @adam=True # avoid overwriting
Parameter "adam" must have no default value but have default value: "False". You may use "adam=True" instead.

@param=value avoids overwriting the default values.

Benefits

  • Attribute suggestions from IDEs (e.g., config.a<tab> indicates config.adam)

License

MIT

Download files

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

Source Distribution

argdcls-0.5.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

argdcls-0.5.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file argdcls-0.5.0.tar.gz.

File metadata

  • Download URL: argdcls-0.5.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.0 Darwin/20.3.0

File hashes

Hashes for argdcls-0.5.0.tar.gz
Algorithm Hash digest
SHA256 385d03d3fb20fa2d2486ab6b9d961fdb81779fba04dcd40aad1752039b4039af
MD5 0c594dcfecfed312099bbbfabb4b34a4
BLAKE2b-256 0fd59f82e228e60221f42239583d11f06fa0f79b64fe6be1a6c2d84a4f460e48

See more details on using hashes here.

File details

Details for the file argdcls-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: argdcls-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.0 Darwin/20.3.0

File hashes

Hashes for argdcls-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6681f5cb5c4f40774a1a73e69dd27965542c7a9833811c52dce3b9c44f02451b
MD5 0d9d2c87b87fcf58f1527b0991249ab7
BLAKE2b-256 b8e6e28c186bf65fa61cecd0c539be8d8e1e2892a2681447c75f3aeb0311d6ce

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page