Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python and PEP 440 - how serious is this warning about PEP440?

I had to install OpenStack using devstack infrastructure for experiements with open vSwitch, and found this in the logs:

/usr/lib/python2.7/site-packages/setuptools/dist.py:298: UserWarning: The version specified ('2014.2.2.dev5.gb329598') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.

I googled and found that PEP stands for Python Enhancement Proposal and PEP 440 is obviously a particular proposal, but I wonder how serious this warning is and what is PEP 440 defining?

like image 253
Mark Avatar asked Dec 15 '14 21:12

Mark


People also ask

What is pep440?

This PEP describes a scheme for identifying versions of Python software distributions, and declaring dependencies on particular versions.

How do I find my pep version?

Get package version in Python script: __version__ attribute To get the version of a package used in a Python script, use the __version__ attribute. The __version__ attribute is recommended by PEP (Python Enhancement Proposals), and many packages have it.

How do I install an older version of a python package?

How do I Install a Specific Version of a Python Package? To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .

Does Python use semantic versioning?

Versioning is the process of adding unique identifiers to different versions of your package. The unique identifier you use may be name-based or number-based, but most Python packages use semantic versioning.


2 Answers

Each Python package can specify its own version. Among other things, PEP440 says that a version specification should be stored in the __version__ attribute of the module, that it should be a string, and that should consist of major version number, minor version number and build number separated by dots (e.g. '2.7.8') give or take a couple of other optional variations. In one of the packages you are installing, the developers appear to have broken these recommendations by using the suffix '.gb329598'. The warning says that this may confuse certain package managers (setuptools and friends) in some circumstances.

It seems PEP440 does allow arbitrary "local version labels" to be appended to a version specifier, but these must be affixed with a '+', not a '.'.

like image 52
jez Avatar answered Sep 22 '22 08:09

jez


As an end user, this shouldn't be a serious concern for you, it just means that, since the version number specified doesn't agree with the rules for python package versions, that the python packaging system cannot reliably discern which other versions of this package are before or after it.

In particular, its not specified if 2014.2.2.dev5.g... should come before or after 2014.2.2.dev5, since the rules don't say anything about what g is supposed to mean.

this is not likely to affect you too much; since either are going to be dev releases; and both strictly are between 2014.2.1 and 2014.2.2

like image 32
SingleNegationElimination Avatar answered Sep 21 '22 08:09

SingleNegationElimination