Skip to content

Commit e3fd4ff

Browse files
Merge pull request #1164 from RonnyPfannschmidt/fix-docs-issues
documentaiton fixes
2 parents f6099a6 + 6655627 commit e3fd4ff

File tree

4 files changed

+70
-1
lines changed

4 files changed

+70
-1
lines changed

.github/workflows/api-check.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,20 @@ jobs:
3434
pip install -e .[test]
3535
3636
- name: Run griffe API check
37+
id: griffe-check
3738
run: |
38-
griffe check setuptools_scm -ssrc -f github
39+
if griffe check setuptools_scm -ssrc -f github; then
40+
echo "api_check_result=success" >> $GITHUB_OUTPUT
41+
else
42+
echo "api_check_result=warning" >> $GITHUB_OUTPUT
43+
echo "API stability check detected changes but will not fail the build" >> $GITHUB_STEP_SUMMARY
44+
fi
45+
46+
- name: Report API check result
47+
if: steps.griffe-check.outputs.api_check_result == 'warning'
48+
uses: actions/github-script@v7
49+
with:
50+
script: |
51+
core.warning('API stability check detected breaking changes. Please review the API changes above.')
52+
core.summary.addRaw('⚠️ API Stability Warning: Breaking changes detected in the public API')
53+
await core.summary.write()

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
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
37+
- fix #790: document shallow fail for rtd
38+
- fix #474: expand version not found error message to provide clearer guidance about SETUPTOOLS_SCM_PRETEND_VERSION_FOR_* environment variables
3639

3740
## v8.3.1
3841

docs/integrations.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
27+
28+
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)
29+
30+
31+
### Enforce fail on shallow repositories
32+
33+
ReadTheDocs may sometimes use shallow Git clones that lack the full history needed for proper version detection. You can use setuptools-scm's environment variable override system to enforce `fail_on_shallow` when building on ReadTheDocs:
34+
35+
```yaml title=".readthedocs.yaml"
36+
version: 2
37+
build:
38+
os: "ubuntu-22.04"
39+
tools:
40+
python: "3.10"
41+
jobs:
42+
post_checkout:
43+
# Avoid setuptools-scm dirty Git index issues
44+
- git reset --hard HEAD
45+
- git clean -fdx
46+
# Enforce fail_on_shallow for setuptools-scm
47+
- export SETUPTOOLS_SCM_OVERRIDES_FOR_${READTHEDOCS_PROJECT//-/_}='{scm.git.pre_parse="fail_on_shallow"}'
48+
```
49+
50+
This configuration uses the `SETUPTOOLS_SCM_OVERRIDES_FOR_${NORMALIZED_DIST_NAME}` environment variable to override the `scm.git.pre_parse` setting specifically for your project when building on ReadTheDocs, forcing setuptools-scm to fail with a clear error if the repository is shallow.

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)