TypedArgs
Strong type args.
Install
From pypi
pip install typed-args
From github
pip install git+https://github.com/SunDoge/typed-args.git@v0.3
Usage
from dataclasses import dataclass
from typed_args import TypedArgs, add_argument
@dataclass
class Args(TypedArgs):
data: str = add_argument('data', metavar='DIR', help='path to dataset')
arch: str = add_argument('-a', '--arch', metavar='ARCH', default='resnet18',
help='model architecture (default: resnet18)')
num_workers: int = add_argument('-j', '--workers', default=4, metavar='N',
help='number of data loading workers (default: 4)')
def test_args():
data = '/path/to/dataset'
arch = 'resnet50'
num_workers = 8
argv = f'{data} -a {arch} --workers {num_workers}'.split()
args = Args.from_args(argv)
assert args.arch == arch
assert args.data == data
assert args.num_workers == num_workers
if __name__ == "__main__":
test_args()
Metadata
Release files for typed-args 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| typed-args-0.3.1.tar.gz | 2.8 kB | Without provenance | Details for typed-args-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| typed_args-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for typed_args-0.3.1-py3-none-any.whl |
Total release size: 6.5 kB
Release files / typed-args-0.3.1.tar.gz
| Download URL | typed-args-0.3.1.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ee11b875dc082bb3eec791eb775e59b1488fa6296822a7bef23d8f3f9095f1e
|
|
BLAKE2b-256 checksum How to use checksums |
f2698d4670b30c7954c6651d1342262c1904e279323227c8ce124780dac12ee1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.6
|
Release files / typed_args-0.3.1-py3-none-any.whl
| Download URL | typed_args-0.3.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
baa324462377070625b180391f35f2dbd1fb66697054ff3aaf8ff978c37995aa
|
|
BLAKE2b-256 checksum How to use checksums |
f1d8bf8ab7cd8d64c1969803e5905bfc43eb0669a1827c16c51de518ca872ae2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.6
|
Security for typed-args 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.