Skip to content

fix: correct source link generation#245

Merged
rich-iannone merged 5 commits into
mainfrom
fix-correct-source-link-generation
Jun 30, 2026
Merged

fix: correct source link generation#245
rich-iannone merged 5 commits into
mainfrom
fix-correct-source-link-generation

Conversation

@rich-iannone

Copy link
Copy Markdown
Member

Source links on API reference pages were built from griffe's relative_package_filepath(), which is relative to the package's parent directory (a griffe search path). For src/-layout projects this drops the leading src/, producing GitHub blob URLs that 404. This PR computes the source path relative to the repository root from the object's absolute filepath (preserving src/ and other non-flat layouts) and honors the existing source.path override for monorepos, bringing the inline SOURCE link in line with the already-correct logic in _build_github_source_url().

rich-iannone and others added 5 commits June 30, 2026 17:05
griffe's `Object.filepath` is a property that raises ValueError when the
object has no parent module (e.g. synthetic objects in tests). A bare
`getattr(..., None)` only suppresses AttributeError, so the ValueError
propagated and crashed rendering. Catch both explicitly and fall through
to the existing None handling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rich-iannone rich-iannone merged commit 576963a into main Jun 30, 2026
8 checks passed
@rich-iannone rich-iannone deleted the fix-correct-source-link-generation branch June 30, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant