Skip to main content

A helper function for setting up an argparse parser.

Project description

Provides some common setup actions for argparse. Import and be happy.

Specifically: init_parser() sets up help, version, and docstring options for a program. Help and version are easy to get with argparse normally; printing your docstring is the interesting part. It returns a parser with these basic options configured. After that, you’ll want to your application-specific customizations.

print_and_exit() is an argparse action for printing an arbitrary string - specifically, in this case, a program’s docstring.

Usage

>>> __version__ = "1.0"
>>> __date__ = "Date of this version's release"
>>> #__doc__ is your docstring, which almost every module should have
>>> import basic_argparse
>>> parser = basic_argparse.init_parser("my awesome program", __version__,
>>>                                     __date__, __doc__)

======== Versions ========

  • Version 1.1: Added sample usage to readme

  • Version 1.0: Extracted from UNT_to_IPA.py

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

basic_argparse-1.1.zip (5.9 kB view details)

Uploaded Source

Built Distribution

basic_argparse-1.1-py27-none-any.whl (3.8 kB view details)

Uploaded Python 2.7

File details

Details for the file basic_argparse-1.1.zip.

File metadata

  • Download URL: basic_argparse-1.1.zip
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for basic_argparse-1.1.zip
Algorithm Hash digest
SHA256 470dff35a41a89ba7dce4bc5c0f75e4542d8f554be5631a492b0f7b05698b12c
MD5 7f3625287e120d57ab1d10ada35033c6
BLAKE2b-256 87d7351c929ce2b4bf528550c471b7980abd23943c07e34580db42c88b014188

See more details on using hashes here.

File details

Details for the file basic_argparse-1.1-py27-none-any.whl.

File metadata

File hashes

Hashes for basic_argparse-1.1-py27-none-any.whl
Algorithm Hash digest
SHA256 741d3e416b1e0bb04feb1b0dd10dc7ff94ffa27fe5e50da1eac4c99c4664af52
MD5 b12518f7c1e3120266c2a5e8c586e0cc
BLAKE2b-256 9bce0a9bb91eca26addb3bc9564d5c780952db62fdf9f772dec921daca8dd3c7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page