flit-scm

raw JSON →
1.7.0 verified Fri May 01 auth: no python

A PEP 517/518 compliant build backend that combines setuptools_scm (to derive package version from VCS tags) with Flit (to build source distributions and wheels). Version 1.7.0 is the latest, supporting Python >= 3.6. Release cadence is low; no active development in the last few years.

pip install flit-scm
error ValueError: unknown or unsupported SCM: git
cause setuptools_scm cannot find Git or the repository isn't a Git repository.
fix
Install Git and initialize a repository, or specify the correct SCM in pyproject.toml: [tool.flit_scm] version_from = "git" or "hg".
error AttributeError: module 'flit_scm' has no attribute 'api'
cause Outdated version of flit-scm (< 1.0.0) used wrong entry point.
fix
Update flit-scm to 1.x and use 'flit_scm:api' as build-backend.
deprecated flit-scm has been superseded by PDM and Hatch; consider migrating to a more modern build backend.
fix Use pdm-backend or hatchling with setuptools_scm directly.
gotcha The version derived by setuptools_scm may not match your expectations if tags are missing or not formatted as PEP 440.
fix Ensure Git tags follow PEP 440 (e.g., v1.0.0) and that you are on a tag for stable releases.
breaking flit-scm requires Python >= 3.6; Python 2 is not supported.
fix Upgrade Python to 3.6+.

Add this to pyproject.toml to use flit-scm as your build backend. Then run 'pip install .' to build and install, or 'python -m build' to create distributions.

# pyproject.toml
[build-system]
requires = ["flit-scm"]
build-backend = "flit_scm:api"

[tool.flit_scm]
version_from = "git"  # or "hg"