Add support for local version as defined in PEP 440
Sometimes, a user might install OpenStack service code directly from Git. Often, stable branches in upstream Git (especially services) have merged code but don’t have a tag on the HEAD of the stable branch. As a result, pbr generates a development version of the library/service.
For example, if the latest tagged version of the code is 1.0.0 and the HEAD is not tagged, the generated version would be 1.0.1devN, where N is the number of commits ahead of the 1.0.0 tag.
This can cause issues when a dependency in requirements specifies <=1.0.0, as 1.0.1devN will not pass the pip resolver. However, PEP 440 provides a solution with “local versions” [1].
This means that if a user installs a service from Git or patches code in his local downstream repository, he can simply tag his custom version as in example below:
- User fix a bug or backport some feature to downstream git repository for customer and tag it as 1.0.0+mylocalversion.
In this case, the pip resolver will accept it since 1.0.0+mylocalversion satisfies the constraint. Additionally, the user can precisely identify the deployed version and track it in their Git repository.
This will be helpful especially in kolla project for generating openstack images.
[1] https://peps.python.org/pep-0440/#local-version-identifiers
Change-Id: I2cf7811fe89353ead4919b3bbf3e2fecd22b0fb6 Signed-off-by: Michal Arbet michal.arbet@ultimum.io Signed-off-by: Stephen Finucane stephenfin@redhat.com Assisted-By: Claude Opus 4.8 noreply@anthropic.com Signed-off-by: Monty Taylor mordred@inaugust.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号