freshcrate
Home > Frameworks > setuptools-scm

setuptools-scm

the blessed package to manage your versions by scm tags

Description

# setuptools-scm [![github ci](https://github.com/pypa/setuptools-scm/actions/workflows/python-tests.yml/badge.svg)](https://github.com/pypa/setuptools-scm/actions/workflows/python-tests.yml) [![Documentation Status](https://readthedocs.org/projects/setuptools-scm/badge/?version=latest)](https://setuptools-scm.readthedocs.io/en/latest/?badge=latest) [![tidelift](https://tidelift.com/badges/package/pypi/setuptools-scm) ](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 <br/> (i.e. it automatically adds all the SCM-managed files to the sdist). <br/> 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 ``` For further configuration see the [documentation]. [setuptools-scm]: https://github.com/pypa/setuptools-scm [documentation]: https://setuptools-scm.readthedocs.io/ [git-archive-docs]: https://setuptools-scm.readthedocs.io/en/stable/usage/#builtin-mechanisms-for-obtaining-version-numbers ## Interaction with Enterprise Distributions Some enterprise distributions like RHEL7 ship rather old setuptools versions. In those cases its typically possible to build by using an sdist against `setuptools-scm<2.0`. As those old setuptools versions lack sensible types for versions, modern [setuptools-scm] is unable to support them sensibly. It's strongly recommended to build a wheel artifact using modern Python and setuptools, then installing the artifact instead of trying to run against old setuptools versions. !!! note "Legacy Setuptools Support" While setuptools-scm recommends setuptools >=80, it maintains compatibility with setuptools 61+ to support legacy deployments that cannot easily upgrade. Support for setuptools <80 is deprecated and will be removed in a future release. This allows enterprise environments and older CI/CD systems to continue using setuptools-scm while still encouraging adoption of newer versions. ## Code of Conduct Everyone interacting in the [setuptools-scm] project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [PSF Code of Conduct]. [PSF Code of Conduct]: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md ## Security Contact To report a security vulnerabili

Release History

VersionChangesUrgencyDate
10.0.5Imported from PyPI (10.0.5)Low4/21/2026
vcs-versioning-v1.1.1### Fixed - Add MANIFEST.in to ensure sdist includes testing_vcs/ when the VCS file finder is unavailable. ([#1336](https://github.com/pypa/setuptools-scm/issues/1336))Medium3/27/2026
setuptools-scm-v10.0.5### Fixed - Allow `dump_version()` deprecation warning to be silenced by passing `scm_version=None`. ([#1286](https://github.com/pypa/setuptools-scm/issues/1286)) - Remove `[tool.uv.sources]` from `setuptools-scm/pyproject.toml` to fix sdist builds outside the workspace β€” the workspace root already declares the source mapping for development. ([#1330](https://github.com/pypa/setuptools-scm/issues/1330))Medium3/27/2026
vcs-versioning-v1.1.0### Added - Add ``fail-on-uncommitted-changes`` as a composable local scheme: raise when the working tree is dirty, otherwise defer to the next local scheme in the list so any ``version_scheme`` can be used. ([#1205](https://github.com/pypa/setuptools-scm/issues/1205)) - When ``HEAD`` is exactly on a tag (``git describe --exact-match``), shallow Git worktrees no longer trigger ``warn_on_shallow``, ``fail_on_shallow``, or ``fetch_on_shallow``β€”shallow clones are enough for tagged release builds aMedium3/27/2026
setuptools-scm-v10.0.4### Fixed - Anchor ``get_version`` in ``setup.py`` with ``relative_to`` and ``fallback_root`` so SCM fallbacks (e.g. ``PKG-INFO``) do not resolve against the wrong directory when the build cwd is the workspace or repo root. ([#1302](https://github.com/pypa/setuptools-scm/issues/1302)) - Enter ``GlobalOverrides`` for ``SETUPTOOLS_SCM`` when using ``setuptools_scm.get_version`` / ``_get_version``, avoiding implicit context warnings for direct API callers. ([#1314](https://github.com/pypa/setuptooMedium3/27/2026
setuptools-scm-v10.0.3### Fixed - Remove monorepo-only ``../vcs-versioning/src`` from ``build-system.backend-path`` so sdists install under PEP 517 (paths must stay inside the source tree). ([#1306](https://github.com/pypa/setuptools-scm/issues/1306)) ### Miscellaneous - Add `griffecli` to test dependencies so the API stability check keeps working after the Griffe CLI was split into a separate package. ([#1310](https://github.com/pypa/setuptools-scm/issues/1310))Medium3/26/2026
setuptools-scm-v10.0.2### Fixed - Fix version file not generated for editable installs. Version files are now written to the source tree by default during inference (restoring pre-10.x behavior), and also registered as ``build_py`` outputs so strict editable installs include them in the persistent auxiliary directory. Set ``SETUPTOOLS_SCM_WRITE_TO_SOURCE=0`` to disable source-tree writing (e.g., for read-only source directories). ([#1298](https://github.com/pypa/setuptools-scm/issues/1298))Medium3/25/2026
vcs-versioning-v1.0.1### Miscellaneous - Simplify release tag creation to use a single `createRelease` API call instead of separate `createTag`/`createRef`/`createRelease` calls, avoiding dangling tag objects on partial failures. ([#release-pipeline](https://github.com/pypa/setuptools-scm/issues/release-pipeline))Low3/19/2026
setuptools-scm-v10.0.1### Miscellaneous - Simplify release tag creation to use a single `createRelease` API call instead of separate `createTag`/`createRef`/`createRelease` calls, avoiding dangling tag objects on partial failures. ([#release-pipeline](https://github.com/pypa/setuptools-scm/issues/release-pipeline))Low3/19/2026
setuptools-scm-v10.0.0### Removed - Drop Python 3.8 and 3.9 support. Minimum Python version is now 3.10. ([#1228](https://github.com/pypa/setuptools-scm/issues/1228)) ### Added - setuptools-scm now depends on vcs-versioning for core version inference logic. This enables other build backends to use the same version inference without setuptools dependency. ([#1228](https://github.com/pypa/setuptools-scm/issues/1228)) - Version files (``write_to`` and ``version_file``) are now written to the build directory duringLow2/26/2026
v9.2.2<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed * fix: don't warn about tool.setuptools.dynamic.version when only using file finder by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1232 **Full Changelog**: https://github.com/pypa/setuptools-scm/compare/v9.2.1...v9.2.2Low10/19/2025
v9.2.1<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed * Mark recently yanked versions in changelog by @seifertm in https://github.com/pypa/setuptools-scm/pull/1209 * Fix 1216 explicitly deprecate setuptools dynamic version when active by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1219 * prepare Release v9.2.1 by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1226 ## New Contributors * @seifertm maLow10/12/2025
v9.2.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed * reiterate version inference by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1202 simple activation now requires a extra instead of setting up many pre-existing projects for failure/error **Full Changelog**: https://github.com/pypa/setuptools-scm/compare/v9.1.1...v9.2.0Low8/16/2025
v9.1.1<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed * handle missing pyproject config in case version keyword is used by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1195 **Full Changelog**: https://github.com/pypa/setuptools-scm/compare/v9.1.0...v9.1.1 yanked after hitting regressions wrt legcy project setups triggering auto activateLow8/11/2025
v9.1.0# yanked a regression makes some sdists report version 0.0.0 ## What's Changed * reiterate version inference logic by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1193 **Full Changelog**: https://github.com/pypa/setuptools-scm/compare/v9.0.3...v9.1.0Low8/11/2025
v9.0.3<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed * fix 1184 infer version indirect should ignore by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1190 **Full Changelog**: https://github.com/pypa/setuptools-scm/compare/v9.0.2...v9.0.3 ## yanked regression wrt specific old project setups vs auto-activateLow8/5/2025
v9.0.2<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed * in case infer-version finds neither the config section, nor the requirement - skip action by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1189 **Full Changelog**: https://github.com/pypa/setuptools-scm/compare/v9.0.1...v9.0.2 ## yanked - new edge cases with auto-activate and preexisting projectsLow8/5/2025
v9.0.1## What's Changed * fix 1180 provide dummy scmversion for dump by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1183 * fix 1181 version keyword doesnt need config by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1185 * add codespell pre-commit hook by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1188 **Full Changelog**: https://github.com/pypa/setuptools-scm/compare/v9.0.0...v9.0.1 ## yanked - edge cases around auto-activatLow8/5/2025
v9.0.0### Breaking - fix #1019: pass python version build tags from scm version to results propperly ### Added - add `setuptools-scm` console_scripts entry point to make the CLI directly executable - make Mercurial command configurable by environment variable `SETUPTOOLS_SCM_HG_COMMAND` - fix #1099 use file modification times for dirty working directory timestamps instead of current time - fix #1059: add `SETUPTOOLS_SCM_PRETEND_METADATA` environment variable to override individual ScmVersiLow8/4/2025
v8.3.1<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed * fix #1131: allow self-build without importlib_metadata by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1132 **Full Changelog**: https://github.com/pypa/setuptools-scm/compare/v8.3.0...v8.3.1Low4/23/2025
v8.3.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed * use importlib_metadata on python <3.10 by @RonnyPfannschmidt in https://github.com/pypa/setuptools-scm/pull/1130 ## New Contributors * @radarhere made their first contribution in https://github.com/pypa/setuptools-scm/pull/1128 **Full Changelog**: https://github.com/pypa/setuptools-scm/compare/v8.2.1...v8.3.0Low4/22/2025
v8.1.0## What's Changed * correctly handle project config overrides when the version keyword is used together with pyproject.toml by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/947 * prepare v8.0.4 release by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/948 * fix #950 - add encoding args to io interaction by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/951 * Reword docker usage hint by @WhyNotHugo in https://github.com/pypa/setuptoolsLow5/6/2024
v8.0.4Release v8.0.4Low10/2/2023
v8.0.3## What's Changed * Share the stderr with the user, when non-zero exit code by @arvidma in https://github.com/pypa/setuptools_scm/pull/927 * fix #918: remove the need for importlib_metadata in general by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/929 * fix #926: ensure mymy on python3.8 accepts version files **Full Changelog**: https://github.com/pypa/setuptools_scm/compare/v8.0.2...v8.0.3Low9/22/2023
v8.0.2## What's Changed * Add timeout to tests by @jaap3 in https://github.com/pypa/setuptools_scm/pull/911 * fix #912 - ensure mypy safe version template by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/915 * Fix #913 larger timeout for unshallow by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/916 * docs: correct word and space in `SETUPTOOLS_SCM_PRETEND_VERSION` warning by @antazoey in https://github.com/pypa/setuptools_scm/pull/917 * fix #914: ignore thLow9/21/2023
v8.0.1## What's Changed * fix #905 - correct version file template for older python versions by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/907 * fix #906: ensure tag regex from setup.py is converted to regex by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/909 **Full Changelog**: https://github.com/pypa/setuptools_scm/compare/v8.0.0...v8.0.1Low9/20/2023
v8.0.0## What's Changed * Apply refurb suggestions by @DimitriPapadopoulos in https://github.com/pypa/setuptools_scm/pull/787 * Fix typo by @BioGeek in https://github.com/pypa/setuptools_scm/pull/801 * Simplify types by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/800 * packaging refinements by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/807 * Remove IO parameter from setup.cfg reader by @jaraco in https://github.com/pypa/setuptools_scm/pull/761 * Fix _Low9/20/2023
v7.1.0Release v7.1.0Low12/17/2022
v7.0.5Release v7.0.5Low7/11/2022
v7.0.4Release v7.0.4Low7/1/2022
v7.0.3## What's Changed * Hg / pip compatibility by @paugier in https://github.com/pypa/setuptools_scm/pull/729 * fix #728: remove git arguments that triggered wrong branch names by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/730 * fix #691 - support root in pyproject.toml even for cli by @RonnyPfannschmidt in https://github.com/pypa/setuptools_scm/pull/731 * fix #727: correctly handle incomplete archivals from setuptools_scm_g… by @RonnyPfannschmidt in https://github.com/pypLow6/28/2022
v7.0.2Release v7.0.2Low6/22/2022
v7.0.1Release v7.0.1Low6/21/2022
v7.0.0Release v7.0.0Low6/21/2022
v6.4.2Release v6.4.2Low1/19/2022
v6.4.1 * fix regression #669: restore get_version signature * fix #668: harden the selftest for distribution extras Low1/18/2022
v6.4.0* compatibility adjustments for setuptools >58 * only put minimal setuptools version into toml extra to warn people with old strict pins * correctly handle hg-git self-use * better mercurial detection * modernize packaging setup * python 3.10 support * better handling of setuptools install command deprecation * consider ``pyproject.tomls`` when running as command * use list in git describe command to avoid shell expansions while supporting both windows and posix * add ``--strip-dev`` flLow1/17/2022
v6.3.2Release v6.3.2Low9/11/2021
v6.3.1Release v6.3.1Low9/10/2021
v6.3.0Release v6.3.0Low9/3/2021
v5.0.1Release v5.0.1Low12/13/2020
v5.0.0 Breaking changes: * fix #339: strict errors on missing scms when parsing a scm dir to avoid false version lookups * fix #337: if relative_to is a directory instead of a file, consider it as direct target instead of the containing folder and print a warning Bugfixes: * fix #352: add support for generally ignoring specific vcs roots * fix #471: better error for version bump failing on complex but accepted tag * fix #479: raise indicative error when tags carry non-parsable informLow12/12/2020
v4.1.2disallows numeric tags without a dot again, turns out this creates many issues for people, projects needing single digit versions need to explicitly allow it Low5/31/2020
v4.1.0Release v4.1.0Low5/25/2020
v4.0.0Release v4.0.0Low5/24/2020
v3.5.0Release v3.5.0Low2/13/2020
v3.4.3Release v3.4.3Low1/22/2020
v3.4.1Release v3.4.1Low1/18/2020
v3.3.1Release v3.3.1Low5/10/2019
v3.2.0Release v3.2.0Low1/16/2019
v3.1.0Release v3.1.0Low8/9/2018

Dependencies & License Audit

Loading dependencies...

Similar Packages

pre-commitA framework for managing and maintaining multi-language pre-commit hooks.v4.6.0
azure-core-tracing-opentelemetryMicrosoft Azure Azure Core OpenTelemetry plugin Library for Pythonazure-template_0.1.0b6187637
spdx-toolsSPDX parser and tools.0.8.5
lacesDjango components that know how to render themselves.0.1.2
django-tasksA backport of Django's built in Tasks framework0.12.0