Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

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.


>>> __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

Project details

Release history Release notifications

This version
History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
basic_argparse-1.1-py27-none-any.whl (3.8 kB) Copy SHA256 hash SHA256 Wheel 2.7 Nov 21, 2013 (5.9 kB) Copy SHA256 hash SHA256 Source None Nov 21, 2013

Supported by

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