Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

PEP 440 Implementation #1

Merged
merged 17 commits into from

4 participants

@dstufft
Owner

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.
packaging/version.py
((12 lines not shown))
+# 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 Owner
qwcode added a note

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 Owner
dstufft added a note

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

@qwcode Owner
qwcode added a note

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

@qwcode Owner
qwcode added a note

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
Merged

PEP 440 Version and Specifiers #1894

tox.ini
@@ -32,7 +33,7 @@ basepython = python2.6
deps =
flake8
pep8-naming
-commands = flake8 .
+commands = flake8 . --exclude tasks/*,.tox,*.egg
@alex
alex added a note

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

@dstufft Owner
dstufft added a note

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
docs/version.rst
((44 lines not shown))
+ >>> 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

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

@dstufft Owner
dstufft added a note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@dstufft dstufft merged commit affaa73 into from
@dstufft dstufft deleted the branch
@dstufft dstufft changed the title from [WIP] PEP 440 Implementation to PEP 440 Implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 3, 2014
  1. @dstufft

    Implement PEP 440 versions

    dstufft authored
  2. @dstufft

    Require 100% test coverage

    dstufft authored
  3. @dstufft

    Implement PEP 440 specifiers

    dstufft authored
  4. @dstufft
  5. @dstufft
  6. @dstufft
  7. @dstufft
  8. @dstufft

    Do not throw away trailing digits for representation

    dstufft authored
    Instead of normalizing 1.0 to 1, we'll continue to keep all of the
    digits that a version normally contains so we can more faithfully
    recreate it. The compare key will still continue to drop trailing
    zeros for comparing versions.
  9. @dstufft
  10. @dstufft

    Switch from : to ! to denote an Epoch

    dstufft authored
    The : character has special connotations on Windows, which makes it
    an invalid character, so we'll use ! instead which is not an invalid
    character.
  11. @dstufft

    Allow empty specifiers

    dstufft authored
  12. @dstufft
  13. @dstufft
  14. @dstufft
Commits on Aug 5, 2014
  1. @dstufft
Commits on Aug 6, 2014
  1. @dstufft
Commits on Aug 9, 2014
  1. @dstufft
Something went wrong with that request. Please try again.