Skip to main content

No project description provided

Project description


Build Status

Strong type args.


From pypi

pip install typed-args

From github

pip install git+


import argparse
import sys

from typedargs import TypedArgs

class Args(TypedArgs):

    def __init__(self):
        parser = argparse.ArgumentParser() str = parser.add_argument('data', metavar='DIR',
                                             help='path to dataset')
        self.arch: str = parser.add_argument('-a', '--arch', metavar='ARCH', default='resnet18',
                                             help='model architecture: ' +
                                             ' (default: resnet18)')
        self.num_workers: int = parser.add_argument('-j', '--workers', default=4, type=int, 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()

    assert args.arch == arch
    assert == data
    assert args.num_workers == num_workers

if __name__ == "__main__":

Project details

Download files

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

Files for typed-args, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size typed_args-0.2.1-py3-none-any.whl (3.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size typed-args-0.2.1.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page