Skip to content

Instantly share code, notes, and snippets.

@erikzaadi
Created November 29, 2012 13:03
Show Gist options
  • Save erikzaadi/4168908 to your computer and use it in GitHub Desktop.
Save erikzaadi/4168908 to your computer and use it in GitHub Desktop.
try:
#NOTE:
# This is a terrible hack, but it works ;)
# The version and description from the setup.py are fetched and parsed
# here..
import pkg_resources # part of setuptools
ver = pkg_resources.require("YOUR_PACKAGE_NAME")[0]
thetitle = [line for line in ver.get_metadata('PKG-INFO').split("\n") \
if line.startswith("Summary")][0].split(":")[1].strip()
version = ver.version
except:
ver, thetitle = "UNKNOWN", "UNKNOWN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment