testtools does not conform to PEP 396

Bug #1452436 reported by David Riddle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
testtools
Triaged
Wishlist
Unassigned

Bug Description

For our package management we use automated tooling to extract version numbers from python packages. I would like to request that you change the __version__ attribute so that it conforms to PEP 396. Currently __version__ returns a tuple according to PEP 396 it should return a string. From what I have seen it is common for the tuple form to be stored in __version_info__.

PEP 396 states:

#. When a module (or package) includes a version number, the version
   SHOULD be available in the ``__version__`` attribute.

#. The ``__version__`` attribute's value SHOULD be a string.

Revision history for this message
Robert Collins (lifeless) wrote :

So, yes, we're not following PEP-396. That said, we've had the current version layout for a long time, and there may well be code depending on it out there.

I'm at best ambivalent about changing this without a major version bump.

Many many packages do not have PEP-396 comaptible version attributes, because it requires opt-in. The distutils database is a much more reliable way to extract version data - everything that is installable is present there. Have you considered using that?

Revision history for this message
David Riddle (ddriddle) wrote :

I am not familiar with the distutils database. I googled and I found setuptools pkg_resources and PEP 376, unfortunately I was not able to find any standard functions in python 2.7 that are able to query the database described in PEP 376. Do they exist? Or is the best way to do that is to use setuputils in python 2.7? Thank you for the advise.

Revision history for this message
Robert Collins (lifeless) wrote :

Sorry, didn't mean to go quiet.

>>> pkg_resources.get_distribution('testtools')
testtools 1.8.0 (/home/robertc/work/pip/.tox/py27/lib/python2.7/site-packages)
>>> pkg_resources.get_distribution('testtools').version
'1.8.0'
>>> pkg_resources.get_distribution('testtools').project_name
'testtools'

Changed in testtools:
importance: Undecided → Wishlist
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.