Summary of the Issue
I am using a fork of a popular package, scikit-learn
, (yes I need a fork for specific technical reasons) that has a documentation hosted with Sphinx. I want to simultaneously use the fork I have and scikit-learn
itself, so I release the fork under a different namespace sklearn_fork
, so I can use it for my own specific purposes.
However, I still want the Sphinx docs to render properly. The issue is that in the fork, I find+replace all instances of "~sklearn.utils.*
" with for example "~sklearn_fork.utils.*
", which basically makes Sphinx not able to find the necessary reference.
Is there a way for me to dynamically add code into my conf.py
, so that way all references for "sklearn_fork" are mapped to "sklearn"?
Basically what I would want is to do the following:
1. <search for all instances of "`sklearn_fork.*`">
2. <replace those instances with "`sklearn.*`">
3. <run Sphinx as is>
Example
As an example, say we have a docstring that had the following find+replaced from "sklearn" to "sklearn_fork".
class OriginalClass:
"""
...
Inside this docstring, there is a sentence that has
the following :func:`~sklearn_fork.utils.Bunch`, or
something like `sklearn_fork.pipeline.Pipeline`, which I
want to replace.
"""
Now I want to reverse that during the Sphinx build. by replacing the docstring so what Sphinx sees is the following:
class OriginalClass:
"""
...
Inside this docstring, there is a sentence that has
the following :func:`~sklearn.utils.Bunch`, or
something like `sklearn.pipeline.Pipeline`, which I
want to replace.
"""