The idea for documenting reimported entities from submodules
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
- I have a function
my_lib.my_module.my_function - I do
from .my_module import my_functioninmy_lib/__init__.py - I want users to access the function as
my_lib.my_function
As far as I understand there is no way to tell pdoc to document the function as my_lib.my_function. Although I see from the website that this is an intentional design decision, I would like to share an idea that is:
- simple
- preserves strong correspondence between the source code and its documentation (i.e. pdoc will be able to fully understand the intended reimports and check their correctness)
The idea is to add a single mapping __pdoc_mapping__ in the root __init__.py (my_lib/__init__.py in the example above) with the following content:
__pdoc_mapping__ = {
# old_name: new_name
'my_function': 'my_module.my_function'
}
What do you think?
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 with pdoc's documented decision on reimported entities and the example in my_lib/init.py. Evaluate the proposed pdoc_mapping for documenting my_lib.my_function while preserving source correspondence, then define acceptance tests for the mapping and its correctness before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100