Truly pythonic argument parser.
Project description
No Argparse Any More.
Don’t google argparse just take some NAAM
I forget how to use argparse every time I make utilities
10+ lines for just parsing arguments? No way!
There should be a super pythonic way to parse arguments!!!!
Install
pip install naam
How to use it
Just decorate your main function like @naam.bind_args and execute it!
Example
Here’s a code (placed in examples/optional.py):
from naam import bind_args
@bind_args
def hello(first_name, last_name=None):
msg = 'Hello world! My name is %s.'
if last_name is None:
print(msg % first_name)
else:
print(msg % '{} {}'.format(first_name, last_name))
hello()
With empty arguments, this outputs:
Usage: optional.py [-l LAST_NAME | --last_name LAST_NAME] FIRST_NAME
With arguments, this outputs like:
$ python optional.py Miku Hello world! My name is Miku. $ python optional.py Miku --last_name Hatsune Hello world! My name is Miku Hatsune. $ python optional.py Miku -l Hatsune Hello world! My name is Miku Hatsune.
Prerequisites
No dependencies. Works on Python 3.x (Built on Python 3.6.2).
Features I crave
Type casting for type-annotated args
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file naam-0.1.1.tar.gz.
File metadata
- Download URL: naam-0.1.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b728514e85537d09c64920169ea3735fdcac16f0c54e27984115943bca5ca15
|
|
| MD5 |
582f5d59048a2d74203c949805eb0890
|
|
| BLAKE2b-256 |
2965a018e9741b738779cf2e38858a104a98624e0751b7913f5069e1a1939375
|
File details
Details for the file naam-0.1.1-py3-none-any.whl.
File metadata
- Download URL: naam-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3716131aa89210a2ea8933f1325515bba837b912d07ccc8d63a905e658f8572a
|
|
| MD5 |
d52f27104e8d9da6ae27b4e89cd011bd
|
|
| BLAKE2b-256 |
efe3ec4deaad7f83ec46bcc248444abeb09bd9c14e8526fd03d306ade86ab64d
|