Skip to main content

Argumentor

Command and argument parsing and documentation for Python CLI.

Feel free to contribute if you find any issues though.

Install

PyPi project

Install using pip

  • $ pip install argumentor-gardehal
  • from Argumentor import *

Install from files locally

  • $ cd [path to this folder]
  • $ pip cache purge (may help if old packages are cached)
  • $ pip install .

Example

Getting started

Creating a command to calculate volume for a given object we have stored somewhere with an ID.

A step further

Creating a command that takes multiple inputs, validating dimensions, and a optional argument with custom casting and validation from string to an enum.

Expected outcomes

The following list of examples explains some expected outcomes, or could be used to test Argumentor. Note: These are based on ExampleAdvanced.py.

# Note, depending on CLI, these results may vary compared to validateString version as below, or as input into CLI (using ' or " would be a main reason as CLI reads it differently)

inputA = "-dim 1 2 3" # Valid
inputB = "-d a b c" # Invalid, a b c cannot be cast to ints unless you create a custom cast function
inputC = "-d width:4 d:5 h:6" # Valid
inputD = "-d w:7 8 d:9" # Valid, note the order: width, then unnamed argument which will be resolved to height because width and depth are named with an alias, then depth
inputE = "-d w:10 11 12" # Valid
inputF = "-d w:13 d:'-14' h:-15" # Invalid, validateInt function does not allow negative values (-14), and arguments (h:-15) starting with the command prefix (default "-") must be a named alias with quotation marks
inputG = "-d w:16 d:':17' h::18" # Invalid, the default int casting (':17') will fail, and arguments with colon ":" (h::18) must be a named alias or in quotation marks
inputH = "-test 19 20 21" # Invalid, command "test" does not exist and nothing will be returned from validate
inputI = "-d 22 24 25 --updateexternal" # Valid, flag --updateexternal will return a static value
inputJ = "-d 26 27 28 --nosuchflag" # Valid, but flag does not exist and reports this through Result.messages
inputK = "-d 29 30 31 ExternalVendorUpdateList:warehouse,default" # Valid, note that the string "warehouse,default" will be cast to a list of strings with these validated items
inputL = "-d 31 32 33 evul:notvalid" # Valid, but "notvalid" is not part of pre-approved ExternalVendorUpdateList items, validated in validateFunc, and results in a message

# Input as string
argResults = argumentor.validateString(inputA)

Recommendations

  1. Use another, more complete argument parser library
  2. See ExampleBasic.py and ExampleAdvanced.py for examples of usage.
  3. Argumentor().validate() returns a list of Result with detected commands. Parse the result with this in mind:
    1. If the list is empty, no command-like input was detected.
    2. When populated, each Result will specify what command was hit by name and have a hitValue that was specified on init.
    3. If a command is detected but has errors, isValid will be false, and messages will details.
    4. Valid commands will have a dict of cast arguments ready to use.
  4. Document your Commands, Arguments, and Flags using descriptions, provide a command (HELP/MAN) for users to see this. Access a printable description of commands through Argumentor().getFormattedDescription().
  5. Arguments have fields for custom casting and validation functions (castFunc, validateFunc), the usage and limitations of these should be documented in descriptions.
  6. Use arguments defaultValue and useDefaultValue to set a default or fallback in case casting or validating input from user fails. In some cases, a validation function is needed for applying default.
  7. Static values can be set using a Flag, if the flag is present in input, the value set in Flag init will be in Result.arguments

TODO

  • for description, some way to group commands or arguments to it can be printed with some sort of title? Makes it easier for walls of text, or maybe options to put something (newlines, "---") between all commands?
    • extra optional input for argumentor, dict[str, Command] where str is the "grouping"?
    • extra optional str to command, "grouping", with separate formatted print command that orders by grouping (sort groupings and commands how exactly?), with grouping header left/right args? e.g. "---- " + command.grouping + " ----"?
  • guaranteed that multiple things can be improved in validate, both efficacy and readability
  • set up github pipeline for testing and publish
    • get version through github release
    • add a cool badge with build status and version

Package Publish/update pip (just notes to publish this package on PyPI)

  1. Install tools
    • python3 -m pip install --user --upgrade twine
    • python3 -m pip install --user --upgrade setuptools wheel
  2. Build and publish (packages and versions appear in build folder)
    • python3 setup.py sdist bdist_wheel
    • python3 -m twine upload dist/*

Metadata

Release files for argumentor-gardehal 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for argumentor-gardehal 0.0.4
File Size Uploaded Provenance
argumentor_gardehal-0.0.4.tar.gz 17.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for argumentor-gardehal 0.0.4
File Interpreter ABI Platform
argumentor_gardehal-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 30.5 kB

Release files / argumentor_gardehal-0.0.4.tar.gz

Download URL argumentor_gardehal-0.0.4.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5ecc676dbd69839f220d49da9c37d81700c9715a8cf876519ea3d1d5128bf969
BLAKE2b-256 checksum
How to use checksums
100b2c259c79a6ab91b6246ac3600c5e17f28835d3c17055ad310c1b1767c675
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 10, 2026.

Transparency log

Release files / argumentor_gardehal-0.0.4-py3-none-any.whl

Download URL argumentor_gardehal-0.0.4-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
446769f6399a4f6f04b946037f74430b7e9608c5928a26768f187cb03cc5505f
BLAKE2b-256 checksum
How to use checksums
da11ab1bd6a7e532b91bea57fcc999a862fece64f8a340431168aeee7f6a5731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 10, 2026.

Transparency log

Security for argumentor-gardehal 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for argumentor_gardehal-0.0.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page