Skip to content

Commit 7c12c8a

Browse files
Fix docs source linking
Co-authored-by: Oriol Abril-Pla <[email protected]>
1 parent 8c5e12d commit 7c12c8a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
22
import inspect
33
import sys
4+
import warnings
5+
46
import pytensor
57
from pathlib import Path
68

@@ -243,7 +245,7 @@ def find_source():
243245
obj = getattr(obj, part)
244246

245247
fn = Path(inspect.getsourcefile(obj))
246-
fn = fn.relative_to(Path(__file__).parent)
248+
fn = fn.relative_to(Path(pytensor.__file__).parent)
247249
source, lineno = inspect.getsourcelines(obj)
248250
return fn, lineno, lineno + len(source) - 1
249251

@@ -252,6 +254,7 @@ def find_source():
252254
try:
253255
filename = "pytensor/%s#L%d-L%d" % find_source()
254256
except Exception:
257+
warnings.warn(f"Could not find source code for {domain}:{info}")
255258
filename = info["module"].replace(".", "/") + ".py"
256259
import subprocess
257260

0 commit comments

Comments
 (0)