Skip to main content

argumentor

argumentor is a simple and lightweight library to build complex command-line tools.

Features

  • Differenciate commands from options
  • Define aliases for commands and options
  • Automatically generate help pages
  • Set default values
  • No external dependencies

Installation

Using pip

The argumentor library can be installed from the Python Package Index (PyPI):

$ pip install argumentor

Installing from source

Using pip, it is also possible to install a package directly from source.

First clone the source code repository hosted on Codeberg:

$ git clone https://codeberg.org/camelia/python-argumentor argumentor

Then, enter the local repository and install argumentor (you may want to use a virtual environment):

$ cd argumentor
$ pip install .

Usage

Below is a minimalist code snippet that aims to demonstrate some basic uses of argumentor:

import sys
from argumentor import Argumentor
from argumentor.exc import ParsingError

argm = Argumentor("program-name")

argm.register_command(
    "cmd1",
    description="command 1",
)
argm.register_command(
    "cmd2",
    description="command 2",
)

argm.register_option(
    "--opt",
    "-o",
    description="global option 1",
)

try:
    cmd, opts = argm.parse()
except ParsingError as err:
    print(err)
    sys.exit(1)

More information about usage can be found in the documentation.

License

argumentor is free software! You are free to use, copy, modify, share and redistribute it under the terms of the GNU Lesser General Public License, version 3 or later.

LGPLv3 badge

Release files for argumentor 2.3.0

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 2.3.0
File Size Uploaded
argumentor-2.3.0.tar.gz 22.6 kB Details

Built distribution (wheel)

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

Total release size: 41.0 kB

Release files / argumentor-2.3.0.tar.gz

Download URL argumentor-2.3.0.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1d511acecb5ca989e4621d0497632f975b627cb1a67aaa160ca7dec3508987e8
BLAKE2b-256 checksum
How to use checksums
487a150b26e02854d3b18fd48c2cbf398f63f0fbe0edfeaef09f28828b2950c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.12

Release files / argumentor-2.3.0-py3-none-any.whl

Download URL argumentor-2.3.0-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d59410c23260dfdcc64235629bd0dd6a15850538d3a4a04c962c24bf98a667e2
BLAKE2b-256 checksum
How to use checksums
aeda5cbeff2248dace05c89f195c482e337afc9b87363a7d7927c403b28a37a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

2.3.0 This release

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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