Skip to content

Commit cc3a61e

Browse files
fix #1100: document readthedocs workaround for dirty worktrees
1 parent f6099a6 commit cc3a61e

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- add support for failing on missing submodules
3434
- fix #279: expand errors when scm can be found upwards and relative_to wasnt used
3535
- fix #577: introduce explicit scmversion node and short node
36+
- fix #1100: add workaround for readthedocs worktress to the docs
3637

3738
## v8.3.1
3839

docs/integrations.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Integrations
2+
3+
## ReadTheDocs
4+
5+
### Avoid having a dirty Git index
6+
7+
When building documentation on ReadTheDocs, file changes during the build process can cause setuptools-scm to detect a "dirty" working directory.
8+
9+
To avoid this issue, ReadTheDocs recommends using build customization to clean the Git state after checkout:
10+
11+
```yaml title=".readthedocs.yaml"
12+
version: 2
13+
build:
14+
os: "ubuntu-22.04"
15+
tools:
16+
python: "3.10"
17+
jobs:
18+
post_checkout:
19+
# Avoid setuptools-scm dirty Git index issues
20+
- git reset --hard HEAD
21+
- git clean -fdx
22+
```
23+
24+
This ensures a clean Git working directory before setuptools-scm detects the version, preventing unwanted local version components.
25+
26+
Reference: [ReadTheDocs Build Customization - Avoid having a dirty Git index](https://docs.readthedocs.com/platform/stable/build-customization.html#avoid-having-a-dirty-git-index)

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ nav:
55
- usage.md
66
- customizing.md
77
- config.md
8+
- integrations.md
89
- extending.md
910
- overrides.md
1011
- changelog.md

0 commit comments

Comments
 (0)