You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/usage.md
+110-6Lines changed: 110 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -376,15 +376,41 @@ accordingly.
376
376
377
377
### Git archives
378
378
379
-
Git archives are supported, but a few changes to your repository are required.
379
+
Git archives are supported, but require specific setup and understanding of how they work with package building.
380
380
381
-
Ensure the content of the following files:
381
+
#### Overview
382
382
383
+
When you create a `.git_archival.txt` file in your repository, it enables setuptools-scm to extract version information from git archives (e.g., GitHub's source downloads). However, this file contains template placeholders that must be expanded by `git archive` - they won't work when building directly from your working directory.
384
+
385
+
#### Setting up git archival support
386
+
387
+
You can generate a `.git_archival.txt` file using the setuptools-scm CLI:
388
+
389
+
```commandline
390
+
# Generate a stable archival file (recommended for releases)
- ✅ **Solution**: Add `exclude .git_archival.txt` to `MANIFEST.in` for development builds
495
+
- ✅ **Alternative**: Build from actual git archives for releases
496
+
497
+
**Problem: "git archive did not support describe output" warnings**
498
+
- ℹ️ **Information**: This is expected when `.git_archival.txt` contains unexpanded templates
499
+
- ✅ **Solution**: Same as above - exclude file or build from git archives
500
+
501
+
**Problem: Version detection fails in git archives**
502
+
- ✅ **Check**: Is `.gitattributes` configured with `export-subst`?
503
+
- ✅ **Check**: Are you building from a properly created git archive?
504
+
- ✅ **Check**: Does your git hosting provider support archive template expansion?
505
+
506
+
!!! warning "Branch Names and Archive Stability"
507
+
508
+
Including `ref-names: $Format:%D$` in your `.git_archival.txt` can make archive checksums change when new commits are added to branches referenced in the archive. This primarily affects GitHub's automatic source archives. Use the stable format (without `ref-names`) unless you specifically need branch information and understand the stability implications.
409
509
510
+
!!! note "Version Files"
410
511
411
-
Note that if you are creating a `_version.py` file, note that it should not
412
-
be kept in version control. It's strongly recommended to be put into gitignore.
512
+
If you are creating a `_version.py` file, it should not be kept in version control. Add it to `.gitignore`:
0 commit comments