arglite
A lightweight, explicit argument parsing library for Python programs.
I made this for a teaching machine project I'm working on (I needed a custom argument parser for reasons), and I'm always too impatient to use argparse.
Quick start
import arglite
arglite.parser.require("name", type=str)
arglite.parser.optional("count", default=1, type=int)
arglite.parser.flag("verbose")
def main():
print(arglite.parser.name)
print(arglite.parser.count)
print(arglite.parser.verbose)
if __name__ == "__main__":
main()
python main.py --name Yo --count 5 --verbose
Documentation
Full documentation is available at arglite.readthedocs.io.
Installation
pip install arglite
Notes
- Flags are case-sensitive.
- Both
-f/--flagand--flag=value/-f=valuesyntaxes are supported. - Values containing spaces work when passed via the shell's normal quoting rules.
- Empty string values (
--name "") are preserved. ast.literal_evalis used for type inference when no explicittypeis given.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
arglite-0.30.0.tar.gz
(13.7 kB
view details)
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
arglite-0.30.0-py3-none-any.whl
(11.4 kB
view details)
File details
Details for the file arglite-0.30.0.tar.gz.
File metadata
- Download URL: arglite-0.30.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ee382c2f1887a5cfc736eab8c3858179665bbb168e34510f34c81867879c90f
|
|
| MD5 |
a4f0bcc4f26210853b6fbb0048cb1776
|
|
| BLAKE2b-256 |
5db18a1c5b977b0870e069d4f47742d85b56613b0f6f8fd457a017650b310c80
|
File details
Details for the file arglite-0.30.0-py3-none-any.whl.
File metadata
- Download URL: arglite-0.30.0-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b1f94b91399dac0ac709d9efbb3050fe65fe750d0f4adaf5c2b4a211029ba7d
|
|
| MD5 |
2c8e087dd24a16f974f3de455d4af801
|
|
| BLAKE2b-256 |
371f6d26bd8c64bd6f13d36c3d7c319f09c148488c4a6a56ef5decd3b37dc161
|