Skip to content

Commit c5af147

Browse files
Merge pull request #70 from UnravelSports/feat/docs
docs + test fix
2 parents 0c4f2a6 + 59baa8d commit c5af147

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

.readthedocs.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@ build:
1818
os: ubuntu-22.04
1919
tools:
2020
python: "3.11"
21-
jobs:
22-
post_install:
23-
# Install package dependencies
24-
- pip install -e .
2521

2622
python:
2723
install:
28-
- requirements: docs/requirements.txt
2924
- method: pip
3025
path: .
26+
- requirements: docs/requirements.txt

docs/source/conf.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@
6060
autodoc_typehints = "description"
6161
autodoc_class_signature = "separated"
6262

63+
# Mock imports for heavy dependencies that aren't needed for building docs
64+
autodoc_mock_imports = [
65+
"torch",
66+
"torch_geometric",
67+
"pytorch_lightning",
68+
"torchmetrics",
69+
"tensorflow",
70+
"keras",
71+
"spektral",
72+
]
73+
6374
# Add any paths that contain templates here, relative to this directory.
6475
templates_path = ["_templates"]
6576

tests/test_soccer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,9 +1586,10 @@ def test_efpi_period_442(self, kloppy_polars_sportec_dataset: KloppyPolarsDatase
15861586

15871587
def test_efpi_wrong(self, kloppy_polars_sportec_dataset):
15881588
import pytest
1589-
from polars.exceptions import PanicException
15901589

1591-
with pytest.raises(pl.exceptions.InvalidOperationError):
1590+
with pytest.raises(
1591+
(pl.exceptions.PanicException, pl.exceptions.InvalidOperationError)
1592+
):
15921593
model = EFPI(dataset=kloppy_polars_sportec_dataset)
15931594
model.fit(
15941595
formations=["442"],

unravel/classifiers/__init__.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ def __init__(self, *args, **kwargs):
1414
__all__ = ["CrystalGraphClassifier"]
1515

1616

17-
from .crystal_graph_pyg import PyGLightningCrystalGraphClassifier
17+
try:
18+
from .crystal_graph_pyg import PyGLightningCrystalGraphClassifier
19+
20+
__all__.append("PyGLightningCrystalGraphClassifier")
21+
except ImportError:
22+
23+
class PyGLightningCrystalGraphClassifier:
24+
def __init__(self, *args, **kwargs):
25+
raise ImportError(
26+
"PyGLightningCrystalGraphClassifier requires PyTorch and PyTorch Geometric. "
27+
"Install with: pip install torch torch-geometric pytorch-lightning torchmetrics"
28+
)
1829

19-
__all__.append("PyGLightningCrystalGraphClassifier")
30+
__all__.append("PyGLightningCrystalGraphClassifier")

0 commit comments

Comments
 (0)