submodule containing a function or class of the same name as the submodule won't be identified
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
Expected Behavior/Steps to reproduce
if we have a submodule something with a function something inside that submodule, both the function and submodule should appear in the generated docs.
Actual Behavior
only the function appears in the docs. this is because in the self.doc dict of a pdoc.Module, they will have the same key and thus the module will never be added.
on line 755 we have:
for root in iter_modules(self.obj.__path__):
# Ignore if this module was already doc'd.
if root in self.doc:
continue
but this erroneously skips adding the submodule.
the fix might be as simple as appending :module to the root key before we store it in the dict, but I'm not sure if this would break things downstream.
Additional info
- pdoc version: 0.11.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pdoc.Module around line 755, where iter_modules populates self.doc and skips roots already present. Trace how self.doc keys are consumed downstream before choosing a distinct module key. Done means a submodule and same-named function both appear in the generated documentation without breaking existing lookups.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100