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>indicatesconfig.adam)
License
MIT
Metadata
Release files for argdcls 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| argdcls-0.5.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| argdcls-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / argdcls-0.5.0.tar.gz
| Download URL | argdcls-0.5.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
385d03d3fb20fa2d2486ab6b9d961fdb81779fba04dcd40aad1752039b4039af
|
|
BLAKE2b-256 checksum How to use checksums |
0fd59f82e228e60221f42239583d11f06fa0f79b64fe6be1a6c2d84a4f460e48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.9.0 Darwin/20.3.0
|
Release files / argdcls-0.5.0-py3-none-any.whl
| Download URL | argdcls-0.5.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6681f5cb5c4f40774a1a73e69dd27965542c7a9833811c52dce3b9c44f02451b
|
|
BLAKE2b-256 checksum How to use checksums |
b8e6e28c186bf65fa61cecd0c539be8d8e1e2892a2681447c75f3aeb0311d6ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.9.0 Darwin/20.3.0
|