Skip to main content

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

  1. uv (recommended)
uv add argumentation
  1. poetry
poetry add argumentation
  1. pip
pip install argumentation

Usage

  1. Create your configuration model using the ArgumentationModel
  2. Create your main function which takes the configuration as an argument
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

argumentation-0.1.0.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

argumentation-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

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

Hashes for argumentation-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a2523fdafe90cead2c6d9b142142680c2afa20db7dcc92edc9e8c6643c954364
MD5 d0e19537dfd1d012a5ee2769b5795607
BLAKE2b-256 b9b884f59b0a6cfbb6b640225c9ad5597f334ac96181edc28c453d8335354662

See more details on using hashes here.

File details

Details for the file argumentation-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for argumentation-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b5a6b9c24c3d90187831c79486ca95331ffc99018af7b7f5e8dc6725236b1b1
MD5 522ce5827064aeff80585f8dac68acf9
BLAKE2b-256 5f6fff47d25ac84ef621de7ae4cae15aeb1d0e8de240af0d97d4e56ef1c1c3c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page