Skip to content

Commit 77d0fda

Browse files
committed
fix dependencies
1 parent c53ae39 commit 77d0fda

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

.readthedocs.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ build:
1414
# nodejs: "16"
1515
# rust: "1.55"
1616
# golang: "1.17"
17-
commands:
18-
# Generate gallery before building docs
19-
- python scripts/generate_gallery.py
2017

2118
# Build documentation in the docs/ directory with Sphinx
2219
sphinx:

docs/source/conf.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,40 @@
1111

1212
import os
1313
import sys
14+
from pathlib import Path
1415

1516
from causalpy.version import __version__
1617

1718
sys.path.insert(0, os.path.abspath("../"))
1819

20+
21+
# Generate gallery before building docs
22+
# This runs after dependencies are installed but before Sphinx processes files
23+
def generate_gallery():
24+
"""Generate example gallery from notebooks."""
25+
try:
26+
# Import here to avoid errors if dependencies aren't available
27+
import subprocess
28+
29+
repo_root = Path(__file__).parent.parent.parent
30+
script_path = repo_root / "scripts" / "generate_gallery.py"
31+
32+
if script_path.exists():
33+
result = subprocess.run(
34+
[sys.executable, str(script_path)],
35+
cwd=str(repo_root),
36+
capture_output=True,
37+
text=True,
38+
)
39+
if result.returncode != 0:
40+
print(f"Warning: Gallery generation failed: {result.stderr}")
41+
except Exception as e:
42+
print(f"Warning: Could not generate gallery: {e}")
43+
44+
45+
# Generate gallery during Sphinx setup
46+
generate_gallery()
47+
1948
# autodoc_mock_imports
2049
# This avoids autodoc breaking when it can't find packages imported in the code.
2150
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_mock_imports # noqa: E501

0 commit comments

Comments
 (0)