Skip to main content

libargs — Python bindings

Unix/GNU-style argument parsing as a Python C extension.

import sys, args

opts = [
    args.opt_bool  ('v', 'verbose', 'enable verbose output'),
    args.opt_string('o', 'output',  'FILE', 'output file', default='a.out'),
    args.opt_int   ('n', 'count',   'N',    'repeat N times'),
    args.opt_float ('r', 'ratio',   'F',    'scaling ratio', default='1.0'),
]

r = args.Parser().parse(sys.argv, opts)

print(r.flag('verbose'))        # bool
print(r.string('output'))       # str | None
print(r.int('count'))           # int | None
print(r.positionals())          # list[str]

Supports: -v, -xvz, -fFILE, --flag, --opt=VAL, --opt VAL, --no-FLAG, -- end-of-args, - stdin, POSIXLY_CORRECT.

Download files

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

Source Distribution

libargs-1.0.1.tar.gz (15.1 kB view details)

Uploaded Source

File details

Details for the file libargs-1.0.1.tar.gz.

File metadata

  • Download URL: libargs-1.0.1.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for libargs-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fc5de4716ef8bede694f863d6f661328c926bdb1b786bb675c7401d80e09dccf
MD5 82de8205f2ee1ca5b9b7ca02bc675433
BLAKE2b-256 169b7033bbe63d92e26faa9bad9af82f997ae04add6d23f9841f58e7d6ba95ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for libargs-1.0.1.tar.gz:

Publisher: ci.yml on quantung-libraries/libargs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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