10000 feat: stamp a canonical dev version instead of semver · Issue #1000 · python-semantic-release/python-semantic-release · GitHub
[go: up one dir, main page]

Skip to content
feat: stamp a canonical dev version instead of semver #1000
Open
@david-waterworth

Description

@david-waterworth

Question

I'm running into issues with python-semantic-release and poetry with my dev builds. I probably have some config set wrong, but python-semantic-release has generated version = "0.8.0-dev.2" in my pyproject.toml and when I run poetry build I end up with

Building my-project (0.8.0-dev.2)
  - Building sdist
  - Built my-project-0.8.0.dev2.tar.gz
  - Building wheel
  - Built my-project-0.8.0.dev2-py3-none-any.whl

Note there's a . (period) between the dev token and the number 2 in the python-semantic-release generated version string but not in the filename. This is causing me grief because in my build script I'm using poetry version to find the file that was created, and I cannot because they don't match.

It looks to me like python-semantic-release is generating a version that matches the longer regex from https://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions but it doesn't match the "canonical" version (r'^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$')

https://packaging.python.org/en/latest/specifications/version-specifiers/#version-specifiers also states

The canonical public version identifiers MUST comply with the following scheme:

[N!]N(.N)*[{a|b|rc}N][.postN][.devN]

Which isn't true for 0.8.0-dev.2 (should be 0.8.0.dev2 if I'm reading this correctly).

I'm assuming that poetry build "canonicalizes" the version when creating the sdist/wheel files?

Is it possible to ensure that python-semantic-release only generates "canonical" version strings in the first place? Or am I missing something?

Configuration

[tool.semantic_release]
upload_to_pypi = false
upload_to_vcs_release = false
build_command = "./scripts/build.sh && ./scripts/publish.sh"
tag_format = "v{version}"
version_toml = [
    "pyproject.toml:tool.poetry.version"
]

[tool.semantic_release.branches.main]
match = "(main|master)"
prerelease_token = "rc"
prerelease = false

[tool.semantic_release.branches.other]
match = "^(feat|fix|perf)/.+"
prerelease_token = "dev"
prerelease = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmedPrevent from becoming stalefeatureA new feature or a feature requestneeds-updateNeeds status update from maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0