{"id":418,"library":"setuptools-scm","title":"setuptools-scm","description":"A package that manages your Python package versions using SCM tags, currently at version 10.0.5, with a release cadence of regular updates.","status":"active","version":"10.0.5","language":"python","source_language":"en","source_url":"https://github.com/pypa/setuptools-scm","tags":["versioning","SCM","packaging"],"install":[{"cmd":"pip install setuptools-scm","lang":"bash","label":"Install setuptools-scm"}],"dependencies":[{"reason":"Required for building and packaging Python projects","package":"setuptools","optional":false}],"imports":[{"note":"Use 'get_version' from 'setuptools_scm' to retrieve the version number.","symbol":"get_version","correct":"from setuptools_scm import get_version"}],"quickstart":{"code":"import os\nfrom setuptools_scm import get_version\n\n# Retrieve the version number\nversion = get_version(root=os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))\n\nprint(f'Version: {version}')","lang":"python","description":"This script imports 'get_version' from 'setuptools_scm' and retrieves the version number of the package."},"warnings":[{"fix":"Upgrade setuptools to version 80 or later.","message":"Support for setuptools versions prior to 80 is deprecated and will be removed in a future release.","severity":"breaking","affected_versions":"<=8.0.0"},{"fix":"Ensure compatibility with the latest setuptools version or adjust your installation method.","message":"Editable installs may break due to changes in '__editable__' and '__path_hook__'.","severity":"gotcha","affected_versions":">=10.0.0"},{"fix":"Ensure the project is built from a complete git repository (including the .git directory) or an official PyPI tarball. If using pip for direct repository installs, use 'git+https://' URLs (e.g., git+https://github.com/user/proj.git#egg=proj). Alternatively, set the version using the environment variable 'SETUPTOOLS_SCM_PRETEND_VERSION_FOR_<NORMALIZED_DIST_NAME>'.","message":"setuptools-scm was unable to detect the package version, likely due to a missing .git directory or building from a source archive without version metadata. This often happens when installing from a plain zip download of a repository.","severity":"breaking","affected_versions":"setuptools-scm:>=0.1"},{"fix":"Ensure the build source is a complete Git repository or a PyPI tarball. Alternatively, set the version using the environment variable SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${NORMALIZED_DIST_NAME} before building.","message":"setuptools-scm was unable to detect the project version. This typically occurs when the build environment lacks a complete Git repository (missing the .git folder) or when building from non-standard source distributions.","severity":"breaking","affected_versions":"setuptools-scm >= 0"}],"env_vars":null,"last_verified":"2026-05-12T13:41:36.589Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Ensure the build environment contains the SCM repository metadata (e.g., by performing a full Git clone). For source distributions, ensure `_version.py` is generated and included in the distribution by setting `write_to` in `pyproject.toml` (e.g., `write_to = \"src/your_package_name/_version.py\"`).","cause":"`setuptools-scm` cannot find Git/Hg metadata (e.g., `.git` directory, tags) or a `_version.py` file during a build process, often in a clean environment or from a source distribution.","error":"LookupError: setuptools-scm was unable to detect a version for 'your_package_name'"},{"fix":"Add `'setuptools-scm'` to the `build-system.requires` list in your `pyproject.toml` file to ensure it is installed as a build dependency, or explicitly install it via `pip install setuptools-scm`.","cause":"The `setuptools_scm` package is not installed in the build environment, preventing `setuptools` from using it as a version management backend.","error":"ModuleNotFoundError: No module named 'setuptools_scm'"},{"fix":"Ensure your Git/Hg repository has a version tag (e.g., `git tag v1.0.0`), commit any pending changes, perform a full clone, or configure `setuptools-scm` in `pyproject.toml` to handle dirty states or untagged commits gracefully (e.g., `local_scheme = \"dirty-tag\"` or `fallback_version`).","cause":"`setuptools-scm` found a Git/Hg repository but could not reliably determine the version string, often due to missing tags, a dirty working tree, or a shallow clone without sufficient history.","error":"UserWarning: setuptools_scm was unable to detect a version for 'your_package_name'."}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"cli_name":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.26,"mem_mb":6.5,"disk_size":"19.6M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.17,"mem_mb":6.5,"disk_size":"20M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.4,"mem_mb":7.1,"disk_size":"21.2M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.33,"mem_mb":7.1,"disk_size":"22M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.33,"mem_mb":7,"disk_size":"22.0M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.32,"mem_mb":7,"disk_size":"22M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.27,"mem_mb":6.3,"disk_size":"21.6M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.27,"mem_mb":6.3,"disk_size":"22M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.9,"mem_mb":15.5,"disk_size":"19.6M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.77,"mem_mb":15.5,"disk_size":"20M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}