readthedocs / readthedocs/sphinx-autoapi
Show source from private modules
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 494
- Forks
- 147
- Avg merge
- 9m
- Merged PRs (30d)
- 1
Description
Sometimes when I don't want to expose everything in a module, subpackage or whatever I go the following way:
my_package
__init__.py
_my_subpackage
__init__.py
_my_module.py
Let's say I would like to expose a class from _my_module.py. Then I would do this via exposing the class into _my_subpackage.__init__.py and then into my_package.__init__.py. So I can then use it like this: my_package.MyClass.
So what I want is to just generate api for the top level part where everything is supposed to be public. Therefore I don't use the private-members configuration.
This works in a sense that MyClass can be seen under autoapi/index.html. However I'm missing the very neat [source] button that redirects me to the source where MyClass is implemented, because obviously the file where it's implement is private and therefore nothing get's generated in the build/html/modules/ directory for it.
Is there a workaround for this by chance? 😆 (I know that this is a very specific kind of case)
Contributor guide
No contributing guide indexed for this repository
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
Reproduce the layout using my_package/init.py, _my_subpackage/init.py, and _my_module.py, then inspect autoapi/index.html and the generated build/html/modules/ output. Trace how the source link for MyClass is generated; done when a publicly exposed class retains a working source link even when its implementation module is private.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100