Replace setuptools_scm's abandoned release-branch-semver scheme (broken by
detached-HEAD branch detection) and the manual version-bump PR process with
scripts/compute_version.py: a dependency-free script that derives PEP 440
versions from git tags/branches, using explicit CI-provided ref info (never
`git rev-parse --abbrev-ref HEAD` alone) and ancestry-independent global tag
comparison for main's "latest shipped release" (release branches never merge
back, so ancestry-based lookup misses sibling-branch releases).
Validated so far:
- Unit tests against synthetic git repos (tests/scripts/test_compute_version.py),
covering all 4 version rules, detached HEAD, GH/GitLab ref resolution, and the
main-after-sibling-branch-release regression case.
- Historical replay against this repo's real git history (via disposable
worktrees) for rules 1-3: exact tag builds, release-branch patch/dev
versions, and freshly-cut release branches all matched expected output.
Still outstanding before this can be trusted in production CI:
- Cross-CI determinism: confirm GitHub Actions and GitLab CI resolve the same
branch name and produce an identical version string for the same commit.
- cibuildwheel's manylinux/musllinux containers: verify `git` is available
(needed since setup.py recomputes the version inside those containers too).
- sdist-then-wheel round trip: confirm ddtrace/_version_frozen.py, written
when git is available, is correctly read back when a wheel is built from an
sdist with no .git present.
- GIT_DEPTH: "0" on the GitLab package/build jobs: confirm against a live
pipeline that full tag history is actually fetched (rule 4's global tag scan
needs it).
Pre-commit hooks (mypy, bandit) skipped for this commit with explicit sign-off:
both are triggered by pre-existing, unrelated issues in scripts/gen_gitlab_config.py's
import graph (tests/suitespec.py, scripts/needs_testrun.py) that predate this
change and are outside mypy.ini's official `files = ddtrace, docs` scope, plus
expected Low-severity bandit findings on this script's inherent subprocess/assert
usage.
Description
Replace setuptools_scm's abandoned release-branch-semver scheme (broken by detached-HEAD branch detection) and the manual version-bump PR process with scripts/compute_version.py: a dependency-free script that derives PEP 440 versions from git tags/branches, using explicit CI-provided ref info (never
git rev-parse --abbrev-ref HEADalone) and ancestry-independent global tag comparison for main's "latest shipped release" (release branches never merge back, so ancestry-based lookup misses sibling-branch releases).Validated so far:
Still outstanding before this can be trusted in production CI:
gitis available (needed since setup.py recomputes the version inside those containers too).