When registering a package on PyPI, you need to pass the version argument to the setup function called by setup.py. Until now, this version information was edited manually, but since I pulled it from the Git tag, I will write it as a memorandum.
setuptools_scm setuptools_scm is a library that pulls information from the version control system and sets setup.py. If you use this, you can calculate and set the version number based on the tag information. There is also a function to automatically add the tracked package data to the package.
When setting the version number using setuptools_scm, pass the following parameters to the setup function of setup.py.
setup.py
from setuptools import setup
setup(
use_scm_version=True,
setup_requires=[
"setuptools_scm"
],
... #Other items omitted
)
Now, when you do python setup.py sdist
, the version number will be calculated properly.
The calculation method of the version number follows the following rules.
See the manual for more information.
To add the tracked package data automatically, add ʻinclude_package_data = True` to the setup function. In other words
setup.py
from setuptools import setup
setup(
use_scm_version=True,
include_package_data=True,
setup_requires=[
"setuptools_scm"
],
... #Other items omitted
)
Let. If there are data files that you are tracking but do not want to include in the package, It can be specified by exclude_package_data. See Manual for details.
Recommended Posts