Skip to content

Commit 346eefd

Browse files
committed
fix: fetch git tags in cibuildwheel for setuptools_scm version detection
cibuildwheel creates isolated build environments where git tags from the outer checkout are not available. This caused setuptools_scm to fall back to v0.5.1 instead of detecting v0.6.0. Solution: Add 'git fetch --force --tags' to the before-build step in cibuildwheel configuration. This ensures setuptools_scm can properly detect the version from git tags inside each build environment. The '|| true' ensures builds still work from source tarballs where git is not available. Fixes PyPI upload failures due to incorrect version numbers in wheel filenames.
1 parent b0583ad commit 346eefd

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎pyproject.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ build = "cp310-* cp311-* cp312-*"
8484
# Skip PyPy, musllinux, and 32-bit builds
8585
skip = "pp* *-musllinux_* *-win32 *-manylinux_i686"
8686

87+
# Fetch tags for setuptools_scm version detection
88+
# The || true ensures build continues even if git fetch fails (e.g., in source tarball builds)
89+
before-build = "git fetch --force --tags || true"
90+
8791
# Test that the wheel can be imported successfully
8892
test-command = "python -c \"import redblackgraph; print('✓ Import successful, version:', redblackgraph.__version__)\""
8993

0 commit comments

Comments
 (0)