Fix TestPyPI publish failure with dynamic dev versioning#123
Fix TestPyPI publish failure with dynamic dev versioning#123Haydnspass merged 3 commits intomainfrom
Conversation
Co-authored-by: Haydnspass <16120273+Haydnspass@users.noreply.github.com>
|
@copilot is it possible to somehow indicate that those are dev versions? adding a .dev to the version? or is that non-compliant? |
Co-authored-by: Haydnspass <16120273+Haydnspass@users.noreply.github.com>
Yes! I've implemented dynamic versioning with setuptools_scm. Now non-tagged pushes will automatically get Changes in commit f8f9bc8:
|
| [project] | ||
| name = "roboreg" | ||
| version = "0.4.6" | ||
| dynamic = ["version"] |
There was a problem hiding this comment.
The version comes from git tags and commit history via setuptools_scm (configured in lines 59-61). When building:
- On a tagged commit (e.g.,
git tag 0.4.6): version =0.4.6 - 2 commits after tag 0.4.6: version =
0.4.7.dev2
setuptools_scm reads the git repository at build time to automatically determine the version number.
TestPyPI publish job fails with "File already exists" error when the workflow runs on pushes because PyPI registries don't allow overwriting existing versions.
Changes
1. Dynamic Versioning with setuptools_scm
Implemented automatic version generation using
setuptools_scmto distinguish between tagged releases and development builds:git tag 0.4.6): Use the tag version as-is →0.4.60.4.7.dev1,0.4.7.dev2, etc.pyproject.toml changes:
2. Workflow Updates
fetch-depth: 0to checkout action to fetch full git history (required for setuptools_scm)skip-existing: trueto TestPyPI publish step as a fallback safety measureBenefits
.devsuffix) are easily distinguishable from releasesOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.