question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

support defining callable get_version kwargs in in pyproject.toml tool.setuptools_scm

See original GitHub issue

Currently 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:open
  • Created 3 years ago
  • Reactions:6
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
RonnyPfannschmidtcommented, Aug 18, 2021

@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

1reaction
RonnyPfannschmidtcommented, May 2, 2020

in the setuptools world its perfectly valid to just use setup.py for that

so im treating this one as low prio, but im happy to review a contribution

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found