Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create partial versions #1

vstojkovic opened this issue Dec 21, 2012 · 3 comments


Copy link

commented Dec 21, 2012

If I pass '2.0' to the Version constructor, I get a ValueError regardless of whether I specified partial=True or not. I suspect that this is because version_re and partial_version_re are completely identical.

If this is intended behavior, then the documentation should be fixed to reflect that.


This comment has been minimized.

Copy link

commented Jan 20, 2013

Indeed, the documentation is not very clear on that topic.

A partial Version is mostly used for the SpecItem class, it is mostly a distinction between ==2.0.0 (doesn't match 2.0.0+1) and ~=2.0.0 (matches 2.0.0+1).

That's not a very useful behaviour, my plan on this topic is:

  1. Add support for coercing arbitrary version strings into semver-compatible ones
  2. Move that code into a private part of SpecItem.

This comment has been minimized.

Copy link

commented Mar 19, 2013

The docs are just plain wrong on the topic. They claim:

In order to define “relaxed” version strings, you must pass in partial=True:

>> v = semantic_version.Version('0.1', partial=True)
>> list(v)
[0, 1, None, None, None]

In reality:

Python 2.7.3 (default, Feb  5 2013, 11:06:02) 
[GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import semantic_version
>>> v = semantic_version.Version('0.1', partial=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/chris.rebert/envs/frank/lib/python2.7/site-packages/semantic_version/", line 64, in __init__
    major, minor, patch, prerelease, build = self.parse(version_string, partial)
  File "/Users/chris.rebert/envs/frank/lib/python2.7/site-packages/semantic_version/", line 86, in parse
    raise ValueError('Invalid version string: %r' % version_string)
ValueError: Invalid version string: '0.1'

@rbarrois rbarrois closed this in f84d754 Mar 20, 2013


This comment has been minimized.

Copy link

commented Mar 20, 2013


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.