Search code examples
setuptoolssetup.pypython-packagingpython-wheelpython-pbr

semantic versions for the wheel file contains devNN


I'm trying to create a python package with the following python setup.py bdist_wheel. The wheel file is generated under my_py_lib-0.0.2.dev19-py2.py3-none-any.whl. The semantic version is appearing as 0.0.2.dev19. However the dev19 is also appearing. How do i remove this value if dev19 ?

Relevant files are given below

setup.py file below

import setuptools
setuptools.setup(
    setup_requires=['pbr>=1.9', 'setuptools>=17.1'],
    pbr=True
)

setup.cfg file's relevant sections below

[metadata]
name = my-py-lib
version = 0.0.2
author = My Name
author_email = [email protected]
summary = tbd
description_file = README.md
license = Apache-2
home_page = https://git-loc.tbd/group/my-py-lib
classifiers =
    Development Status :: 4 - Beta
    Intended Audience :: Developers
    Intended Audience :: Information Technology
    License :: OSI Approved :: Apache Software License
    Operating System :: Unix
    Programming Language :: Python :: 3.6
 
[options]
include_package_data = true
zip_safe = false
install_requires = requests;pprintpp;
 
[files]
packages = my-py-lib
 
[bdist_wheel]
universal = 1

Solution

  • It turns out that the pbr uses the latest git tag to determine the version number. In my original project, I did not have a git tag and as a result the value of version = 0.0.2 from the setup.cfg was being used and 0.0.2.dev19 was created.
    Now, I'd created a git tag with command. git tag v0.0.2 After creation of the .devM tag is removed and the semantic version mentioned in the git tag is considered. The value in [metadata] of setup.cfg section is commented out. The version is directly picked up from the semantic version tag.
    Reference: pbr features link