Skip to main content

A simple package for parsing function arguments from the command line

Project description

ParseArgs

Example:

from parseargs import parseargs



def fun(firstname, lastname:str, number:int = 5):
	print(f"Hello {firstname} {lastname}")
	print(f"Your number is {number}")
	number *= 2
	print(f"Twice your number is {number}")



parseargs(fun)

Now on the command line, you can do:

python fun.py ricky bobby --number 5

Notice how it will print out 10. If you remove the annotation declaring the number an int, it will instead print out 55.

Project details


Download files

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

Files for parseargs, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size parseargs-0.0.2-py3-none-any.whl (2.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size parseargs-0.0.2.tar.gz (1.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page