Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adgaudio/argparse_tools
Share a standardized set of argparse arguments within your codebase. Wraps argparse.
https://github.com/adgaudio/argparse_tools
Last synced: 15 days ago
JSON representation
Share a standardized set of argparse arguments within your codebase. Wraps argparse.
- Host: GitHub
- URL: https://github.com/adgaudio/argparse_tools
- Owner: adgaudio
- Created: 2014-08-03T02:24:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-07T00:18:31.000Z (over 9 years ago)
- Last Synced: 2024-09-03T20:37:35.331Z (2 months ago)
- Language: Python
- Size: 238 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
This package wraps argparse to facilitate sharing a standardized set of
arguments across various scripts and applications that may use argparse.For example, assume you have two scripts, "runthis.py" and "runthat.py," both
of which share common arguments. It may make sense to share the argument logic
between runthis and runthat. See the examples directory for an
implementation of runthis and runthat.Features:
- Share common arguments between scripts
- ability to override specific argument options via @lazy_kwargs decorator
- Set default values directly from environment variables by
setting action=DefaultFromEnv in the argument's options.
- I think it's slightly cleaner than default argparse
- Used at Sailthru in production
- Actually, I use this everywhere I write Python code!```
$ cat argparse_tools/examples/runthat.py
$ python argparse_tools/examples/runthat.py$ cat argparse_tools/examples/runthis.py
$ python argparse_tools/examples/runthis.py --opt2 isrequired$ MYVAR_FENV=111 python argparse_tools/examples/runthis.py --opt2 isrequired
```