Skip to main content

A helper for type-checked command-line argument store

Project description

init_attrs_with_kwargs

A helper for type-checked command-line argument store.

Please refer to the home page on the github for installation and usage.

Sample

from init_attrs_with_kwargs import cast_set_attrs

class MyArgs:
    count: int
    name: str
    max_length: int

# Initialize from docopt's return value, with casting str to int
args = cast_set_attrs(MyArgs(), **{'<count>': '1', '--name': "Joe", '--max-length': '100'})

print("args.count=%s" % repr(args.count))
print("args.name=%s" % repr(args.name))
print("args.max_length=%s" % repr(args.max_length))

Project details


Download files

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

Source Distribution

init_attrs_with_kwargs-0.2.0.tar.gz (5.9 kB view hashes)

Uploaded Source

Built Distribution

init_attrs_with_kwargs-0.2.0-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page