arger 1.2.5
pip install arger==1.2.5
Released:
Create argparser automatically from functions
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: Freely Distributable, MIT License (MIT)
- Author: Noortheen Raja
- Requires: Python >=3.6, <4.0
Classifiers
- Development Status
- Environment
- Intended Audience
- License
- Natural Language
- Operating System
- Programming Language
Project description
Overview
A wrapper around argparser to help build CLIs from functions. Uses type-hints extensively :snake:.
Setup
:gear: Installation
Install it directly into an activated virtual environment:
$ pip install arger
or add it to your Poetry project:
$ poetry add arger
:books: Usage
- create a python file called test.py
from arger import Arger
def main(param1: int, param2: str, kw1=None, kw2=False):
"""Example function with types documented in the docstring.
:param param1: The first parameter.
:param param2: The second parameter.
"""
print(locals())
if __name__ == '__main__':
Arger(main).run()
-
Here Arger is just a subclass of
ArgumentParser
. It will not conceal you from using otherargparse
libraries. -
run this normally with
python test.py 100 param2
- Checkout examples folder and documentation to see more of
arger
in action. It supports any level of sub-commands.
Features
- Uses docstring to parse help comment for arguments. Supports
- Flags will be generated from parameter-name.
If needed you could declare it inside docstring like
:param arg1: -a --arg this is the document
. Also one can usedef main(arg1:int=Argument(flags=('-a', '--arg'), ...): ...
- The decorated functions can be composed to form nested sub-commands of any level.
- No external lib dependency
- Most of the Standard types supported. Please see examples for more supported types with examples.
- All argument to
ArgumentParser.add_argument
is supported. It can be updated witharger.Argument
classes. *args
supported but no**kwargs
support yet.- all optional arguments that start with underscore is not passed to
Parser
. They are considered private to the function implementation. Some parameter names with special meaning_namespace_
-> to get the output from theArgumentParser.parse_args()
_arger_
-> to get the parser instance
This project was generated with cookiecutter using jacebrowning/template-python.
Argparser enhancements
- web-ui : https://github.com/nirizr/argparseweb
- extra actions : https://github.com/kadimisetty/action-hero
- automatic shell completions using argcomplete
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: Freely Distributable, MIT License (MIT)
- Author: Noortheen Raja
- Requires: Python >=3.6, <4.0
Classifiers
- Development Status
- Environment
- Intended Audience
- License
- Natural Language
- Operating System
- Programming Language
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
File details
Details for the file arger-1.2.5.tar.gz
.
File metadata
- Download URL: arger-1.2.5.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.6 Linux/5.4.0-1032-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
cb79e15f2bc487a182c31e1950d6ecbe5ed909ab0fd804fa818f907a6bb835bb
|
|
MD5 |
ddf969d88ba1899cf45d4b0a58a00c20
|
|
BLAKE2b-256 |
c0aa5f4f98aa634d26938a07d5ff3b120b14d5198a1d35bebc8be8fb57136caf
|
File details
Details for the file arger-1.2.5-py3-none-any.whl
.
File metadata
- Download URL: arger-1.2.5-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.6 Linux/5.4.0-1032-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
010ed8137eb14a702cba2a29e6671b10d80aa756cc30b9079dc21afa972b1ccc
|
|
MD5 |
e2f4f95c8ffc0f6d28c565e5ea9ecb93
|
|
BLAKE2b-256 |
7282e1f634f1de97b9d094e5c62adcb067a655a5d392f1a34c13a0c5ab4bcb59
|