PEP 440 Implementation #1

Merged
merged 17 commits into from Aug 26, 2014

1 participant

@dstufft
Python Packaging Authority member

TODO

  • Sort local versions using the PEP sort order.
  • Figure out where exactly prefix operators are valid (issue).
  • Figure out if ~=N is a valid operator (issue).
  • Don't allow ~=N.
  • Document the spec? Maybe just linking to PEP 440 is enough?
  • Write a contrib script that will test versions on PyPI against Version() and Version.suggest().
  • Write a contrib script that will test version sorting on PyPI against how we sort then and how pkg_resources sorts them.
  • Implement Version.suggest().
  • Implement Version().is_prerelease or something similar.
  • Ensure all of the specifiers sanely handle Epoch versions.
  • Convert local versions to use + as a separator rather than ~. See issue.
  • Disallow a prefix match after a .devN segment (e.g. ==1.0.dev1.*).
  • Implement extra normalization steps to increase compatibility.
  • Implement ===<anything> which can be used as an escape hatch for non conformant versions.

Pending PEP Updates

  • Local versions are alphanumeric and .
  • Disallow "top level" ~= like ~=1.
  • Removal of default comparison operator
  • Removal of parentheses and returning to the pkg_resources style.
  • rc and c equivalency.
  • Use + instead of ~ for local versions.
  • Disallow a prefix match after a .devN segment (e.g. ==1.0.dev1.*).
  • Document extra normalization steps to increase compatibility.
  • Document the ===<anything> escape hatch.
  • Do not move the local version into a Wheel build number.
  • Figure out how all of our characters map into filenames in current packaging tools.
  • Update the compatibility statistics.
@qwcode qwcode and 1 other commented on an outdated diff May 19, 2014
packaging/version.py
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from __future__ import absolute_import, division, print_function
+
+import collections
+import itertools
+import re
+
+from ._structures import Infinity
+
+# TODO: We deviate from the spec in that rc and c are considered equivalent
+# instead of having rc sort after c. We should fix the spec.
+
+# TODO We deviate from the spec in that local versions are sorted
+# lexicographically. We need a sort order but it appears the PEP will go
+# a different way.
@qwcode
qwcode added a note May 19, 2014

more than just sorting, the fact that you're allowing letters at all.
the spec is written to only support -N[.N]+], although there was a recent conversation to change that.

@dstufft
Python Packaging Authority member
dstufft added a note May 19, 2014

I mean gosh, it's a whole 2 days old, keep up! ;)

@qwcode
qwcode added a note May 19, 2014

ok, that hasn't made it up to the PEP page yet.

@qwcode
qwcode added a note May 19, 2014

I had brought it up recently here: https://mail.python.org/pipermail/distutils-sig/2014-May/024185.html

so I figured an update was coming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@dstufft dstufft referenced this pull request in pypa/pip Jun 25, 2014
Merged

PEP 440 Version and Specifiers #1894

@alex alex and 1 other commented on an outdated diff Aug 8, 2014
@@ -32,7 +33,7 @@ basepython = python2.6
deps =
flake8
pep8-naming
-commands = flake8 .
+commands = flake8 . --exclude tasks/*,.tox,*.egg
@alex
Python Packaging Authority member
alex added a note Aug 8, 2014

You should put the exclude in the flake8 section so that people can just run flake8 on the CLI.

@dstufft
Python Packaging Authority member
dstufft added a note Aug 8, 2014

The reason I did this, was at the time the tasks were Python 3 only. That might not actually be the case anymore though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@merwok merwok commented on the diff Aug 9, 2014
docs/version.rst
+ >>> combined_spec
+ <Specifier('!=1.1,>=1.0,~=1.0')>
+ >>> # We can check a version object to see if it falls within a specifier
+ >>> v1 in combined_spec
+ False
+ >>> v2 in combined_spec
+ True
+ >>> # We can even do the same with a string based version
+ >>> "1.4" in combined_spec
+ True
+
+
+Reference
+---------
+
+.. class:: Version(version)
@merwok
merwok added a note Aug 9, 2014

IIRC the things in parens in a Sphinx class definition should be base classes, not arguments for __init__.

@dstufft
Python Packaging Authority member
dstufft added a note Aug 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@dstufft dstufft merged commit affaa73 into master Aug 26, 2014

1 check passed

Details continuous-integration/travis-ci The Travis CI build passed
@dstufft dstufft deleted the pep440 branch Aug 26, 2014
@dstufft dstufft changed the title from [WIP] PEP 440 Implementation to PEP 440 Implementation Aug 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment