File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 - name : Install dependencies
4444 run : |
4545 python -m pip install --upgrade pip
46- python -m pip install build sphinx pydata_sphinx_theme
46+ python -m pip install build sphinx==5.3.0 pydata_sphinx_theme==0.11.0
4747
4848 - name : Get new version number from input
4949 id : version_number
Original file line number Diff line number Diff line change 1- sphinx-build -b html ./docs ./build/html
1+ sphinx-build -b html ./docs ./build/html -E
22pause
Original file line number Diff line number Diff line change 66
77# -- Path setup --------------------------------------------------------------
88
9+ import inspect
10+
911# If extensions (or modules to document with autodoc) are in another directory,
1012# add these directories to sys.path here. If the directory is relative to the
1113# documentation root, use os.path.abspath to make it absolute, like shown here.
2426project = "fourinsight-api"
2527copyright = f"{ date .today ().year } , 4Subsea"
2628author = "4Subsea"
29+ github_repo = "https://github.com/4Subsea/fourinsight-api-python/"
2730
2831# The full version, including alpha/beta/rc tags
2932version = metadata .version (project )
4043 "sphinx.ext.autodoc" ,
4144 "sphinx.ext.napoleon" ,
4245 "sphinx.ext.intersphinx" ,
46+ "sphinx.ext.linkcode" ,
4347]
48+
49+
50+ def linkcode_resolve (domain , info ):
51+ if domain != "py" :
52+ return None
53+ if not info ["module" ]:
54+ return None
55+
56+ obj = sys .modules [info ["module" ]]
57+
58+ for part in info ["fullname" ].split ("." ):
59+ obj = getattr (obj , part )
60+ obj = inspect .unwrap (obj )
61+
62+ try :
63+ path = os .path .relpath (inspect .getfile (obj ))
64+ src , lineno = inspect .getsourcelines (obj )
65+
66+ path = f"{ github_repo } blob/main/{ path } #L{ lineno } -L{ lineno + len (src ) - 1 } "
67+
68+ except Exception :
69+ path = None
70+ return path
71+
72+
4473autosummary_generate = True
4574
4675# Napoleon settings
86115 "icon_links" : [
87116 {
88117 "name" : "GitHub" ,
89- "url" : "https://github.com/4Subsea/fourinsight-api-python" ,
118+ "url" : github_repo ,
90119 "icon" : "fab fa-github" ,
91120 },
92121 {
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ envlist = py39
55[testenv]
66deps =
77 build
8- sphinx
9- pydata_sphinx_theme
8+ sphinx ==5.3.0
9+ pydata_sphinx_theme ==0.11.0
1010commands =
1111 python -m build --outdir ./build
1212 sphinx-build -b html ./docs ./build/html
Original file line number Diff line number Diff line change 1515basepython = python3.9
1616changedir = docs
1717deps =
18- sphinx
19- pydata_sphinx_theme
18+ sphinx ==5.3.0
19+ pydata_sphinx_theme ==0.11.0
2020commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
You can’t perform that action at this time.
0 commit comments