Python argument parser for complex applications
Project description
Argumentation
Argumentation is a Python library that bridges Pydantic models with argparse to create robust, type-safe command-line interfaces with minimal boilerplate. Define your application's configuration using Pydantic models, and Argumentation handles the command-line parsing, validation, and configuration file loading automatically.
Features
- Type-safe Configuration: Utilize Pydantic's validation system for command-line arguments
- Configuration Files: Support for TOML, YAML, and JSON configuration files
- Automatic CLI Generation: Convert your Pydantic models into command-line interfaces automatically
- Rich Type Support: Handles complex types including:
- Basic types (bool, int, float, str)
- Lists and tuples
- Literal types with choices
- Union types
- Custom Pydantic models
Installation
- uv (recommended)
uv add argumentation
- poetry
poetry add argumentation
- pip
pip install argumentation
Usage
- Create your configuration model using the ArgumentationModel
- Create your main function which takes the configuration as an argument
- Call the argumentation.run function with your main function
See examples/simple.py for more details
python examples/simple.py --name "My Application" --debug --port 5000 --hosts localhost 127.0.0.1
Configuration Files
Argumentation supports loading configuration from TOML, YAML, and JSON files.
python examples/config.py --config examples/config.yaml
You can also override configuration file values from the command line.
python examples/simple.py --config examples/config.yaml --port 8888
License
Argumentation is licensed under the MIT License. See the LICENSE file for details.
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 argumentation-0.1.0.tar.gz.
File metadata
- Download URL: argumentation-0.1.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2523fdafe90cead2c6d9b142142680c2afa20db7dcc92edc9e8c6643c954364
|
|
| MD5 |
d0e19537dfd1d012a5ee2769b5795607
|
|
| BLAKE2b-256 |
b9b884f59b0a6cfbb6b640225c9ad5597f334ac96181edc28c453d8335354662
|
File details
Details for the file argumentation-0.1.0-py3-none-any.whl.
File metadata
- Download URL: argumentation-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b5a6b9c24c3d90187831c79486ca95331ffc99018af7b7f5e8dc6725236b1b1
|
|
| MD5 |
522ce5827064aeff80585f8dac68acf9
|
|
| BLAKE2b-256 |
5f6fff47d25ac84ef621de7ae4cae15aeb1d0e8de240af0d97d4e56ef1c1c3c6
|