Render package __init__.py at the directory's index.html#46
Closed
danceratopz wants to merge 1 commit intoSamWilsn:masterfrom
Closed
Render package __init__.py at the directory's index.html#46danceratopz wants to merge 1 commit intoSamWilsn:masterfrom
danceratopz wants to merge 1 commit intoSamWilsn:masterfrom
Conversation
Previously each package's index.html showed only an empty directory listing while __init__.py.html held the module documentation. Route __init__.py sources to <dir>/index so the package's documentation is the landing page; the cli skips writing the synthetic ListingSource when a non-listing source already covers that path, preserving parent-listing navigation entries.
a02d47c to
bc5358c
Compare
SamWilsn
reviewed
Apr 28, 2026
Owner
SamWilsn
left a comment
There was a problem hiding this comment.
This is giving special privilege to the listing plugin, and feels a bit hacky.
I'm not sure what a better solution in this vein would be. Maybe every source could have a priority and the highest priority claims the output path? That way there's no special case for listings.
That said, I think the better solution is still to not generate the listing in the first place, but I've been having some difficulty coming up with an elegant implementation of that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
__init__.pysources to<dir>/indexso each package's landing page (index.html) is the rendered module documentation instead of an empty directory listingListingSourcein the navigation tree, but skip writing its file incli.pywhen a non-listing source already covers the same output path — this preserves thedocc/,plugins/, etc. entries in parent listings while letting the module page win atindex.htmlExample
Test plan
tox -e py3passes (lint + tests +doccself-build)tox -e typepasses (pyre)__init__.py.htmlfiles;index.htmlexists for every package and contains the rendered__init__.py<pkg>/index.htmlsrc/index.htmllistsdocc/)