Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

console script boilerplate

Project description

console script boilerplate

some boilerplate stuff for console scripts. inspired by now unmaintained pyCLI.

decorate your main function and register it in your as console_scripts entry_point [1]. the function will receive an app object as argument.

you get:

  • pythons ArgumentParser
  • KeyboardInterrupt is catched
  • SIGTERM is handled, so that context managers will exit properly
  • logging helper

exit_handler and sigterm_handler may be customized.



from csboilerplate import cli_app

def main(app):
    # do your stuff

main.argparser.add_argument('-d', '--debug', action='count', default=0,
                            help='lower logging threshold, may be used twice')

dev env

checkout git and:

virtualenv .env -p python3
. .env/bin/activate
pip install -e .[dev]

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 csboilerplate, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size csboilerplate-0.1.0.tar.gz (7.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page