Export version number as a tuple

Bug #497585 reported by Jonathan Lange on 2009-12-17
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
launchpadlib
Low
Unassigned

Bug Description

launchpadlib is a library that other applications are coming to depend on. The API for launchpadlib itself is still in flux, with new APIs being added in each release.

It would be very useful to have a tuple of integers provided by launchpadlib that described the version. This way, depending applications could make intelligent decisions about whether they can work with a particular version of launchpadlib.

Note that this is a fairly standard practice among Python libraries. See bzrlib for an example of this being done well.

Leonard Richardson (leonardr) wrote :

Just to be sure: you're talking about the Python API of launchpadlib itself (things like Launchpad.login_with), right? Not launchpadlib's Python interface to the Launchpad web service, which is entirely determined by the documents Launchpad serves.

Jonathan Lange (jml) wrote :

Yes, that's right. login_with and launchpadlib.uris being the most interesting things for me personally.

Changed in launchpadlib:
status: New → Triaged
importance: Undecided → Low
Gary Poster (gary) wrote :

I suspect you don't like these, but they exist.

>>> import launchpadlib
>>> launchpadlib.__version__
'1.6.0'
>>> import pkg_resources
>>> pkg_resources.working_set.find(pkg_resources.Requirement.parse('launchpadlib')).parsed_version
('00000001', '00000006', '*final')

Jonathan Lange (jml) wrote :

Thanks Gary. I knew about the __version__ string, but that's a difficult thing to do programmatic comparison on.

I didn't know about pkg_resources though. Maybe it's not the place to ask, but, why aren't those zero-prefix numbers represented as actual ints?

On Apr 23, 2010, at 12:30 PM, Jonathan Lange wrote:

> Thanks Gary. I knew about the __version__ string, but that's a difficult
> thing to do programmatic comparison on.

Ack.

> I didn't know about pkg_resources though. Maybe it's not the place to
> ask, but, why aren't those zero-prefix numbers represented as actual
> ints?

Ask PJE :-)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers