Skip to content

Commit 06871ee

Browse files
nejchJohnVillalovos
authored andcommitted
chore: patch sphinx for explicit re-exports
1 parent 0bbcad7 commit 06871ee

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

docs/api/gitlab.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Module contents
88
:members:
99
:undoc-members:
1010
:show-inheritance:
11+
:noindex:
1112

1213
.. autoclass:: gitlab.Gitlab
1314
:members:

docs/conf.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,30 @@
1919
import sys
2020
from datetime import datetime
2121

22+
from sphinx.domains.python import PythonDomain
23+
2224
sys.path.append("../")
2325
sys.path.append(os.path.dirname(__file__))
2426
import gitlab # noqa: E402. Needed purely for readthedocs' build
2527

28+
29+
# Sphinx will warn when attributes are exported in multiple places. See workaround:
30+
# https://github.com/sphinx-doc/sphinx/issues/3866#issuecomment-768167824
31+
# This patch can be removed when this issue is resolved:
32+
# https://github.com/sphinx-doc/sphinx/issues/4961
33+
class PatchedPythonDomain(PythonDomain):
34+
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
35+
if "refspecific" in node:
36+
del node["refspecific"]
37+
return super(PatchedPythonDomain, self).resolve_xref(
38+
env, fromdocname, builder, typ, target, node, contnode
39+
)
40+
41+
42+
def setup(sphinx):
43+
sphinx.add_domain(PatchedPythonDomain, override=True)
44+
45+
2646
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
2747
year = datetime.now().year
2848

0 commit comments

Comments
 (0)