I'm using setuptools and setuptools_scm.
The version_scheme i use is release-branch-semver.
Let's say I create a branch release-0.1.0 and have 3 commits.
I'm done then I create a tag 0.1.0 from the head of release-0.1.0
I push both tag and branch to my github repository. Then I use twine to package the python library and upload to pypi as 0.1.0
Then i branch off from main to make a release-0.1.1 and do work on it.
After a few days later, I realized there was a serious bug on 0.1.0. So I checkout back to release-0.1.0 and added 1 more commit to the local branch.
So what do I do now?
I definitely don't want the faulty version 0.1.0 on pypi as it is. I'm already halfway doing 0.1.1. So creating a hotfix off main branch as 0.1.1 is also weird.
Can i replace the 0.1.0 in pypi? Should i delete the 0.1.0 tag on the github remote repo?
CodePudding user response:
If you released a version to PyPI that shouldn't be used by anyone, you can yank the release. That means it won't be listed on the project page and it won't be considered by installers such as pip
when searching for compatible versions (it's not deleted though and installation can be forced via ==
).
Working on 0.1.1
implies that this includes only fixes for 0.1.0
. So when you discover that serious bug, you can just include it in the 0.1.1
fix and release it. Then you can continue the remaining fixes on 0.1.2
.
Existing releases shouldn't be modified and hence, when you finish a release, there's no reason to retain the release branch. Typically you would tag a x.y.z
release on the main branch and then build from there.