Automatic version number both in setup.py (setuptools) AND source code?

前端 未结 7 1339
没有蜡笔的小新
没有蜡笔的小新 2020-12-24 11:21

SITUATION:

I have a python library, which is controlled by git, and bundled with distutils/setuptools. And I want to automatically generate version

7条回答
  •  無奈伤痛
    2020-12-24 11:45

    You could also reverse the dependency: put the version in mylib/__init__.py, parse that file in setup.py to get the version parameter, and use git tag $(setup.py --version) on the command line to create your tag.

    git tag -a v$(python setup.py --version) -m 'description of version'
    

    Is there anything more complicated you want to do that I haven’t understood?

提交回复
热议问题