Skip to content

Commit 3ffb29f

Browse files
authored
Fix broken link to python doc (#564)
Apply the same change as rapidsai/cuml#6202 to fix Python links to source code. Closes #533 Authors: - Micka (https://github.com/lowener) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: #564
1 parent 8aae706 commit 3ffb29f

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def setup(app):
198198
linkcode_resolve = make_linkcode_resolve(
199199
"cuvs",
200200
"https://github.com/rapidsai/cuvs/"
201-
"blob/{revision}/python/cuvs/cuvs/"
201+
"blob/{revision}/python/cuvs/"
202202
"{package}/{path}#L{lineno}",
203203
)
204204

docs/source/sphinxext/github_link.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# This contains code with copyright by the scikit-learn project, subject to the
22
# license in /thirdparty/LICENSES/LICENSE.scikit_learn
3+
#
4+
# Copyright (c) 2024-2025, NVIDIA CORPORATION.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
318

419
import inspect
520
import os
@@ -101,10 +116,9 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
101116
else:
102117
return
103118
else:
104-
# Test if we are absolute or not (pyx are relative)
105-
if (not os.path.isabs(fn)):
106-
# Should be relative to docs right now
107-
fn = os.path.abspath(os.path.join("..", "python", fn))
119+
if fn.endswith(".pyx"):
120+
sp_path = next(x for x in sys.path if re.match(".*site-packages$", x))
121+
fn = fn.replace("/opt/conda/conda-bld/work/python/cuvs", sp_path)
108122

109123
# Convert to relative from module root
110124
fn = os.path.relpath(fn,

0 commit comments

Comments
 (0)