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

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)

Source distribution for argdcls 0.5.0
File Size Uploaded
argdcls-0.5.0.tar.gz 3.7 kB Details

Built distribution (wheel)

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

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

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