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

weird version_tuple when hardcoding version_scheme #557

Closed
nschloe opened this issue Apr 13, 2021 · 2 comments
Closed

weird version_tuple when hardcoding version_scheme #557

nschloe opened this issue Apr 13, 2021 · 2 comments
Labels

Comments

@nschloe
Copy link

nschloe commented Apr 13, 2021

I would like to use setuptools_scm to append a git sha if applicable, and in any case use a hard-coded version number as base (instead of a Git tag). To this end, I use the "version_scheme":

      use_scm_version={
          "version_scheme": lambda _: "4.1.0",
          "write_to": "foobar/version.py"
      }

The command

python3 setup.py --version

correctly produces

4.1.0+g4ac9d2c

but the version_tuple in version.py is weird:

version = '4.1.0+g4ac9d2c'
version_tuple = (4, 1, '0+g4ac9d2c')

I would have expected

version_tuple = (4, 1, 0, 'g4ac9d2c')
# or perhaps
version_tuple = (4, 1, 0, '+g4ac9d2c')

What's going wrong here?

@RonnyPfannschmidt
Copy link
Contributor

https://github.com/pypa/setuptools_scm/blob/b366d8b3faebd9ef276305854847e9fb4d1c3576/src/setuptools_scm/__init__.py#L87-L94 is incomplete, its a bug

@RonnyPfannschmidt
Copy link
Contributor

this should use packaging.version to pick things apart correctly

kkirsche added a commit to kkirsche/setuptools_scm that referenced this issue Apr 15, 2021
kkirsche added a commit to kkirsche/setuptools_scm that referenced this issue Apr 15, 2021
This pull request updates the tuple parser to use `packaging.version`'s parser to retrieve the release tuple. This then checks for the dev and local attributes, including those if applicable.
kkirsche added a commit to kkirsche/setuptools_scm that referenced this issue Apr 15, 2021
This pull request updates the tuple parser to use `packaging.version`'s parser
to retrieve the release tuple. This then checks for the dev and local
attributes, including those if applicable.
kkirsche added a commit to kkirsche/setuptools_scm that referenced this issue Apr 15, 2021
This pull request updates the tuple parser to use `packaging.version`'s parser
to retrieve the release tuple. This then checks for the dev and local
attributes, including those if applicable.
RonnyPfannschmidt added a commit that referenced this issue Apr 22, 2021
Fix #557 - Use packaging.version for version_tuple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants