setuptools_scm: Incorrect removal of dash in case of pre-release tag string ?

I found this today: 1.0.0-rc1 becomes 1.0.0rc1, see details here https://github.com/smarie/python-getversion/issues/10

The underlying error is due to pkg_resources that removes the pre-release dash automatically in its string representation since version 0.6a9.

However as suggested in my conclusions I think that the issue should probably better be fixed in the default scheme of setuptools_scm because faithfulness to git tags and compliance with semver for example, is probably a higher concern for you than for pkg_resources.

Thanks again for this great package !

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (21 by maintainers)

Commits related to this issue

Most upvoted comments

In general, I try to avoid normalizing user inputs, to honor the user’s indication, and only to normalize in storage or comparison. However, the consensus from the Python community seems to be to prefer normalization early, to essentially disregard the user’s intention and replace it with a normal form.

It does seem to me to be a gap that the most popular versioning scheme (semver) is in conflict with the packaging normalization rules.

I like the idea of providing an “alternate but built-in” version that’s lenient to semver syntax. That would provide an opportunity to explore an implementation and to give users a nice escape hatch. I’d probably not recommend this except for very popular and compatible forms like semver.

I’ll try to shoot a PR by tomorrow

Preformat is unrelated to this issue

Setuptools_scm should reject wrong versions

So parsing is necessary

A version subclass that stores the non normalised version seem to be a working solution