简体   繁体   中英

How to indicate use_scm_version in setup.cfg?

I'm switching from using setup.py to setup.cfg . How can I indicate in setup.cfg that I want use_scm_version= True ?

Did you try the following:

from setuptools import setup
from setuptools.config import read_configuration

conf_dict = read_configuration("setup.cfg")
PKG_NAME = conf_dict['metadata']['name']

setup(
    use_scm_version={"write_to": f"{PKG_NAME}/_version.py"},
)

Source: https://github.com/pypa/setuptools_scm/issues/582

I have resolved this by adding pyproject.toml file with following code, forcing building to be implemented with setuptools_scm :

# pyproject.toml
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
version_scheme = "post-release"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM