← 输入框|github.com|刷新
Skip to content

Library is partially non-compliant with semver spec #114

Closed

Description

@dbarella

Breaking input: 0.0.0-0foo.1

Expected result:

>>> import semver
>>> semver.parse('0.0.0-0foo.1')
{'build': None, 'major': 0, 'patch': 0, 'minor': 0, 'prerelease': '0foo.1'}

Actual result:

>>> import semver
>>> semver.parse('0.0.0-0foo.1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/semver.py", line 65, in parse
    raise ValueError('%s is not valid SemVer string' % version)
ValueError: 0.0.0-0foo.1 is not valid SemVer string

Per item 9, only numeric IDs cannot contain leading zeros -- since 0foo is not entirely numeric, it may contain a leading zero.

Activity

  1. s-celles commented on Nov 25, 2018

    @s-celles
    Member

    I also understand it this way:

    Numeric identifiers MUST NOT include leading zeroes.
    

    so

    Non numeric identifiers MAY include leading zeroes.
    

    What is your opinion @k-bx ?

    PR (with fix and test) are welcome @dbarella !

  2. sirzooro commented on Nov 20, 2019

    @sirzooro

    Any update on this? We use git commit hash as a prerelease part, so sometimes we trigger this error too.

  3. tomschr commented on Nov 20, 2019

    @tomschr
    Member

    If I'm not mistaken, it is related (or a duplicate?) of #194.

  4. added 2 commits that reference this issue on Nov 20, 2019
  5. sirzooro commented on Nov 21, 2019

    @sirzooro

    Yes, it is a duplicate. You can close this issue.

  6. added
    Duplicate
    on Nov 21, 2019
  7. tomschr commented on Nov 21, 2019

    @tomschr
    Member

    Duplicate of #194 so closing.

  8. added a commit that references this issue on Nov 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Duplicate

    Type

    No type

    Fields

    SIze

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions