Skip to content

Instantly share code, notes, and snippets.

@ssokolow
Last active January 8, 2022 17:43
Show Gist options
  • Save ssokolow/151572 to your computer and use it in GitHub Desktop.
Save ssokolow/151572 to your computer and use it in GitHub Desktop.
Python boilerplate from which I start all my projects
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""[application description here]"""
__appname__ = "[application name here]"
__author__ = "Stephan Sokolow (deitarion/SSokolow)"
__version__ = "0.0pre0"
__license__ = "GNU GPL 3.0 or later"
import logging
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
# -- Code Here --
if __name__ == '__main__':
from optparse import OptionParser
parser = OptionParser(description=__doc__, version="%%prog v%s" % __version__)
#parser.add_option('-v', '--verbose', action="store_true", dest="verbose",
# default=False, help="Increase verbosity")
opts, args = parser.parse_args()
@dotbugfix
Copy link

Any specific reason for using OptionParser instead of the more popular ArgParse?

@MotorCityCobra
Copy link

Must be cause this post is old

@metachris
Copy link

Also take a look at python-boilerplate.com for various up-to-date Python boilerplates!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment