readthedocs / readthedocs/sphinx-autoapi

Show source from private modules

Open
#515 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needed: Reproduction Case
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.