provide a way to get Distribute version programmatically

Create issue
Issue #347 new
Chris Jerdonek created an issue

It doesn't seem like there's a way to get the version of Distribute programmatically. This is useful for diagnostic purposes (e.g. for printing the version of Distribute being used in log messages). For example, using version 0.6.34:

>>> import setuptools
>>> setuptools
<module 'setuptools' from '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/__init__.pyc'>
>>> setuptools.__version__

I understand that there are probably reasons for having __version__ return 0.6. But a different attribute could be exposed for the Distribute version.

The only way I found to get the version was from the command-line running:

$ pip freeze

Comments (5)

  1. Arfrever Frehtes Taifersar Arahesis


    • pkg_resources.get_distribution("distribute").version
    • pkg_resources.get_distribution("setuptools").version
  2. Arfrever Frehtes Taifersar Arahesis

    These workaround work only for previously installed Distribute, not a working copy, so I think that setuptools.__version_info__ attribute (tuple of 3 integers) could be introduced.

  3. Log in to comment