Skip to main content

Make your arg parsing even more declarative!

Project description

logo Make your arg parsing even more declarative!

badge badge badge


Source code: https://github.com/Xaaq/Rocket-args

Documentation: https://xaaq.github.io/Rocket-args


Overview

So you wanted a tool that handles parsing arguments? You've come to right place!

Key features:

  • fully declarative,
  • less boilerplate code required,
  • type hints,
  • IDE auto-completion - no more strange Namespace objects.

Installation

You will need Python 3.6+

In order to install it:

pip install rocket-args

Examples

Simple CLI args

Create main.py with following content:

from rocket_args import RocketBase

class MyArgs(RocketBase):
    my_int: int
    my_float: float
    my_str: str

args = MyArgs.parse_args()
print(args)

Call it with arguments:

$ python main.py --my-int 1234 --my-float 12.34 --my-string abcd
MyArgs(my_int=1234, my_float=12.34, my_str=abcd)

Auto-generated help

$ python main.py --help
usage: main.py [-h] [--my-int MY_INT] [--my-float MY_FLOAT] [--my-str MY_STR]

optional arguments:
  -h, --help           show this help message and exit
  --my-int MY_INT
  --my-float MY_FLOAT
  --my-str MY_STR

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

rocket-args-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

rocket_args-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file rocket-args-0.1.0.tar.gz.

File metadata

  • Download URL: rocket-args-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.8.0 Linux/4.15.0-1028-gcp

File hashes

Hashes for rocket-args-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e5a2763f672db18782d9e4de4fe81d3ecb1b95912dc43450e557478ad40b76a
MD5 ea492a08e73bee97fbcfbce53ca7c909
BLAKE2b-256 6e51fd770c9ec50a54001e4272d8cec41a22ab94fe2e92d529d9b0d43f87dc9b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rocket_args-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.8.0 Linux/4.15.0-1028-gcp

File hashes

Hashes for rocket_args-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40c7937aa9fc198eb4964fed5ed47a3828ca22429b60767f2c5cbd62c17531f1
MD5 c0c02576caa4eaa9a1497bf1e1ec3441
BLAKE2b-256 5f5ee0ddc599c6b02bc9f8fe0bb0a8b820e1132bf1c2bf3f4073981f3d9f5c2c

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