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

multibranch releases convert semver version to pep440 version #844

Closed
intex46 opened this issue Feb 21, 2024 · 4 comments
Closed

multibranch releases convert semver version to pep440 version #844

intex46 opened this issue Feb 21, 2024 · 4 comments

Comments

@intex46
Copy link

intex46 commented Feb 21, 2024

Hello, i use multibranch releases to create alpha python packages, here my pyproject.toml config:

[tool.semantic_release]
logging_use_named_masks = true
tag_format = "v{version}"
commit_parser = "angular"
commit_message = "chore(release): release v{version} [skip ci]"
remove_dist = true


[tool.semantic_release.remote]
domain = "dev.azure.com"

[tool.semantic_release.changelog]
exclude_commit_patterns = [
    "^wip :.*",  
    "^Merged PR.*", 

]

[tool.semantic_release.branches.main]
match = "main"
prerelease = false

[tool.semantic_release.branches.develop]
match = "develop"
prerelease = true
prerelease_token="rc"

[tool.semantic_release.branches.feature]
match = "^feature/.*$"
prerelease = true
prerelease_token = "alpha"

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

dynamic = ["version"]
[tool.pdm.version]
source = "scm"

When i'm on a feature branch i use : semantic-release -vv version --push --no-vcs-release --no-changelog --build-metadata $(git branch --show-current) to generate my feature alpha version in order to avoid conflict with other developer who start from the same version as i , however when i push the generated wheel to artifact it convert v0.1.2-alpha1+abcd to 0.1.2.a1 , so another developer who create his branch starting from the same version v0.1.1 would have the same python package version as i and can't deploy his package to artifact since the version already exists

Is there any solution to avoid this conflict , i tried to insert the version package in the pyproject.toml file using version params but the generated version does not respect pep440 format (0.1.2.a1+abcd), so the current version will point at it which is no good for production purpose

the idea is when building the python package it will convert v0.1.2-alpha1+abcd to 0.1.2.a1.devabcd or something like this

@codejedi365
Copy link
Contributor

@intex46, thank you for posting your question and rationale. I have been doing some research on the request and should have an answer for you shortly.

@codejedi365
Copy link
Contributor

codejedi365 commented Feb 27, 2024

@intex46, first thing to note is that both the wheel builder and PSR are adhering to PEP440 format.

The version scheme you describe falls under the category of Local Version Identifiers. Local identifiers allow for build metadata to be appended to the version via a +. This is what PSR is doing when it stamps the version into pyproject.toml. Given the intent of build metadata, this is the correct behavior of PSR.

Since the build metadata is not allowed in Public Version Identifiers, the wheel build drops it upon build. This is also correct behavior.

To still accomplish your workflow, I would recommend modifying the build command that you supply PSR to call an internal script or sed command that will convert the + to a . in the version number field of pyproject.toml and then call your build command. This script would enable PSR to stamp the version in and then call your script as the build step.

@codejedi365 codejedi365 added the awaiting-reply Waiting for response label Apr 7, 2024
Copy link

github-actions bot commented May 6, 2024

This issue has not received a response in 14 days. If no response is received in 7 days, it will be closed. We look forward to hearing from you.

Copy link

This issue was closed because no response was received.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants