support defining callable get_version kwargs in in pyproject.toml tool.setuptools_scm
See original GitHub issueCurrently when using the non-legacy pyproject.toml setuptools_scm configuration, you are unable to define inline callable version schemes - you’re forced to publish a package on pypi and use its entry point. setuptools_scm should provide a declarative alternative to:
#setup.py
import setuptools
def myversion():
from setuptools_scm.version import get_local_dirty_tag
def clean_scheme(version):
return get_local_dirty_tag(version) if version.dirty else '+clean'
return {'local_scheme': clean_scheme}
setup(
...,
use_scm_version=myversion,
...
)
for example:
# pyproject.toml
[tool.setuptools_scm]
local_scheme = "scm_schemes:clean_scheme"
# scm_schemes.py
from setuptools_scm.version import get_local_dirty_tag
def clean_scheme(version):
return get_local_dirty_tag(version) if version.dirty else '+clean'
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:8 (5 by maintainers)
Top Results From Across the Web
setuptools-scm - PyPI
setuptools_scm. setuptools_scm extracts Python package versions from git or hg metadata instead of declaring them as the version argument or in a SCM ......
Read more >setuptools-scm [python-library] - Occam :: Details
If you see unusual version numbers for packages but python setup.py --version reports the expected version number, ensure [egg_info] is not defined in...
Read more >Frequently Asked Questions - PyScaffold
In any case you need to specify the root of the repository relative to the root of your project. pyproject.toml : [tool.setuptools_scm] ...
Read more >python - how to use release branch to increment version using ...
Branches main and v0.1.0 don't have pyproject.toml, so you need to add that file. version_scheme should be under [tool.setuptools_scm] ...
Read more >setuptools-scm - Pants build
A tool for generating versions from VCS metadata (https://github.com/pypa/setuptools_scm). Backend: pants.backend.experimental.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ahopkins things changed a bit as more and more static metadata stuff is incoming
im still not convinced its a good idea to support random imports for the schmes, but im happy to accept a pr
in the setuptools world its perfectly valid to just use
setup.py
for thatso im treating this one as low prio, but im happy to review a contribution