Skip to main content

the blessed package to manage your versions by scm tags

Project description

setuptools-scm

github ci Documentation Status tidelift

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.

⚠️ 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.

[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.

To enable version inference, you need to set the version dynamically in the project section of 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:

[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:

$ python -m setuptools_scm
# To explore other options, try:
$ python -m setuptools_scm --help

For further configuration see the documentation.

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.

Security Contact

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setuptools_scm-9.2.1.tar.gz (202.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

setuptools_scm-9.2.1-py3-none-any.whl (62.9 kB view details)

Uploaded Python 3

File details

Details for the file setuptools_scm-9.2.1.tar.gz.

File metadata

  • Download URL: setuptools_scm-9.2.1.tar.gz
  • Upload date:
  • Size: 202.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for setuptools_scm-9.2.1.tar.gz
Algorithm Hash digest
SHA256 2f5b21e45205e47ed3976e58bc29c38f49bb9b6f07c625c7fd2823871694b244
MD5 8379d4fc2ba1a295bf12df6e49510b66
BLAKE2b-256 d0327d8f405986239e829556ea369b7451ba885c3dc8472ae07b9437b375f6e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for setuptools_scm-9.2.1.tar.gz:

Publisher: python-tests.yml on pypa/setuptools-scm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file setuptools_scm-9.2.1-py3-none-any.whl.

File metadata

  • Download URL: setuptools_scm-9.2.1-py3-none-any.whl
  • Upload date:
  • Size: 62.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for setuptools_scm-9.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 84c9b3f39ffb77ba00dd92a06e025e4f66dc69ab8df1c2a225a0678e76311f8d
MD5 e4c0d7fca880d0a7e780bbb160de767b
BLAKE2b-256 11cc5fda7ed3aab0814a86e428846b6b386f55093f4621d86e3cd081ae126c27

See more details on using hashes here.

Provenance

The following attestation bundles were made for setuptools_scm-9.2.1-py3-none-any.whl:

Publisher: python-tests.yml on pypa/setuptools-scm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page