Port variant | v12 |
Summary | Package to manage versions by scm tags (3.12) |
Package version | 9.2.0 |
Homepage | https://pypi.org/project/setuptools-scm/ |
Keywords | python |
Maintainer | Python Automaton |
License | Not yet specified |
Other variants | v13 |
Ravenports | Buildsheet | History |
Ravensource | Port Directory | History |
Last modified | 17 AUG 2025, 15:45:57 UTC |
Port created | 20 APR 2020, 15:00:59 UTC |
single | # setuptools-scm
[github ci]
[Documentation Status]
[![tidelift]](https://tidelift.com/subscription/pkg/pypi-setuptools-scm?utm_source=pypi-setuptools-scm&utm_medium=readme)
## about
[setuptools-scm] extracts Python package versions from `git` or `hg`
metadata
instead of declaring them as the version argument
or in a Source Code Managed (SCM) managed file.
Additionally [setuptools-scm] provides `setuptools` with a list of
files that are managed by the SCM
(i.e. it automatically adds all the SCM-managed files to the sdist). Unwanted files must be excluded via `MANIFEST.in` or [configuring Git archive][git-archive-docs]. > **⚠️ Important:** Installing setuptools-scm automatically enables a file finder that includes **all SCM-tracked files** in your source distributions. This can be surprising if you have development files tracked in Git/Mercurial that you don't want in your package. Use `MANIFEST.in` to exclude unwanted files. See the [documentation] for details. ## `pyproject.toml` usage The preferred way to configure [setuptools-scm] is to author settings in a `tool.setuptools_scm` section of `pyproject.toml`. This feature requires setuptools 61 or later (recommended: >=80 for best compatibility). First, ensure that [setuptools-scm] is present during the project's build step by specifying it as one of the build requirements. ```toml title="pyproject.toml" [build-system] requires = ["setuptools>=80", "setuptools-scm>=8"] build-backend = "setuptools.build_meta" ``` That will be sufficient to require [setuptools-scm] for projects that support [PEP 518] like [pip] and [build]. [pip]: https://pypi.org/project/pip [build]: https://pypi.org/project/build [PEP 518]: https://peps.python.org/pep-0518/ To enable version inference, you need to set the version dynamically in the `project` section of `pyproject.toml`: ```toml title="pyproject.toml" [project] # version = "0.0.1" # Remove any existing version parameter. dynamic = ["version"] [tool.setuptools_scm] ``` !!! note "Simplified Configuration" Starting with setuptools-scm 8.1+, if `setuptools_scm` (or `setuptools-scm`) is present in your `build-system.requires`, the `[tool.setuptools_scm]` section becomes optional! You can now enable setuptools-scm with just: ```toml title="pyproject.toml" [build-system] requires = ["setuptools>=80", "setuptools-scm>=8"] build-backend = "setuptools.build_meta" [project] dynamic = ["version"] ``` The `[tool.setuptools_scm]` section is only needed if you want to customize configuration options. Additionally, a version file can be written by specifying: ```toml title="pyproject.toml" [tool.setuptools_scm] version_file = "pkg/_version.py" ``` Where `pkg` is the name of your package. If you need to confirm which version string is being generated or debug the configuration, you can install [setuptools-scm] directly in your working environment and run: ```console $ python -m setuptools_scm # To explore other options, try: $ python -m setuptools_scm --help ``` |
Build (only) |
python312:dev:std python-pip:single:v12 autoselect-python:single:std |
Build and Runtime | python312:primary:std |
Runtime (only) |
python-packaging:single:v12 python-setuptools:single:v12 |
main | mirror://PYPIWHL/f7/14/dd3a6053325e882fe191fb4b42289bbdfabf5f44307c302903a8a3236a0a |
mercurial:std | Scalable distributed version control system |
python-afdko:v12 | Adobe Font Development Kit for OpenType (3.12) |
python-borgbackup:v12 | Deduplicated, encrypted, compressed backups (3.12) |
python-cffsubr:v12 | CFF subroutinizer based on AFDKO tx tool (3.12) |
python-compreffor:v12 | CFF subroutinizer for fontTools (3.12) |
python-freetype-py:v12 | Freetype python bindings (3.12) |
python-lazy-object-proxy:v12 | Fast and thorough lazy object proxy (3.12) |
python-mwparserfromhell:v12 | Parser for MediaWiki wikicode (3.12) |
python-psautohint:v12 | Wrapper for Adobe's PostScript autohinter (3.12) |
python-pyclipper:v12 | Cython wrapper for the AJ Clipper library (3.12) |