ArguMint
A fresh new way to handle cli.
This package is just maintained (EOL) as I have rewritten large parts of the package (2k new LOC) and plan to release them under the new name autocli. This could take a 1-2 months though as the old owner of the name seems unresponsive.
I have also updated it with the latest code from aplustools.package.autocli and applied a few patches and quality of life enhancements.
The latest release 2.0.0 brings with it a totally new and more refined interface for managing the cli. These enhancements are from the new 'autocli' package.
This is done so that an MVP of autocli exists, that can always be used in cases where using autocli may not be preferable. For example, in a minimal project the argumint.py file can easily be included while using the entire autocli directory could be more cumbersome.
Another reason is so that projects using argumint can slowly transition to autocli, while we wait for the name to be possibly available.
How to use it
from argumint import Interface, ArgumentParsingError
from typing import Literal
def build_file(path: Literal["./main.py", "./file.py"] = "./main.py", num: int = 0) -> None:
"""
build_file
:param path: The path to the file that should be built.
:param num:
:return None:
"""
print(f"Building file {path} ..., {num}")
def print_program_help() -> None:
print("This is the CLI for aps, and it does ... and ... .")
from chronix import FlexTimer
timer = FlexTimer()
# Initialization
parser = Interface("aps", path_seperator="::")
# Add endpoints / paths
parser.path("build::file", build_file)
parser.path("build::dir::main")
parser.path("build::dir::all")
parser.path("help", print_program_help)
# Testing
try:
print("---- 1 ----")
parser.parse_cli(["main.py", "help"]) # Displays program help
print(timer.lap().to_readable())
print("---- 2 ----")
parser.parse_cli(["main.py", "build", "file", "./file.py", "--num", "19"])
print(timer.lap().to_readable())
print("---- 3 ----")
parser.parse_cli() # Displays cli help
print(timer.lap().to_readable())
print("---- 4 ----") # Warning about native_light mode and error
parser.parse_cli(["main.py", "build", "file", "./file.py", "--num", "=", "19"], "native_light")
print(timer.lap().to_readable())
except ArgumentParsingError as e:
print(f"There was an error while parsing '{e}'.")
timer.end()
Metadata
Release files for argumint 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| argumint-2.0.1.tar.gz | 19.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| argumint-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.3 kB
Release files / argumint-2.0.1.tar.gz
| Download URL | argumint-2.0.1.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09df81a4e0bcbcd503e56722415b77524df51f135e147775da17280bcfa70ddf
|
|
BLAKE2b-256 checksum How to use checksums |
47cdb41b36fb1e3c9a0770d17370216f18d1a2fd33aae6e02042b52ae7378013
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / argumint-2.0.1-py3-none-any.whl
| Download URL | argumint-2.0.1-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f0b59d3a33e631a4fdc3b550cebc621abc0a6bb466f39151cea9259041bd9f86
|
|
BLAKE2b-256 checksum How to use checksums |
4e2f04fdf12170b740bf6f1ad563bbfa0951798bcf1aea9a2e8aedcc8b035ceb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|