Skip to content

Commit 9259818

Browse files
committed
ci/test: validate compatibility with pytorch_lightning
1 parent 6906993 commit 9259818

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.github/workflows/ci-testing.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os: ["ubuntu-22.04", "macOS-13", "windows-2022"]
19+
os: ["ubuntu-24.04", "macOS-13", "windows-2022"]
2020
python-version: ["3.9", "3.12"]
2121
requires: ["latest"]
22+
dependency: ["lightning"]
2223
include:
23-
- { os: "ubuntu-20.04", python-version: "3.9", requires: "oldest" }
24+
- { os: "ubuntu-22.04", python-version: "3.9", requires: "oldest", dependency: "lightning" }
25+
- { os: "ubuntu-24.04", python-version: "3.10", requires: "latest", dependency: "pytorch_lightning" }
26+
- { os: "ubuntu-24.04", python-version: "3.12", requires: "latest", dependency: "pytorch_lightning" }
27+
- { os: "macOS-14", python-version: "3.12", requires: "latest", dependency: "pytorch_lightning" }
2428

2529
# Timeout: https://stackoverflow.com/a/59076067/4521646
2630
timeout-minutes: 35
@@ -41,11 +45,22 @@ jobs:
4145
pip install 'lightning-utilities[cli]'
4246
python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]'
4347
48+
- name: Adjust requirements
49+
run: |
50+
pip install 'lightning-utilities[cli]' -U -q
51+
python -m lightning_utilities.cli requirements replace-pkg \
52+
--old_package="lightning" \
53+
--new_package="pytorch-lightning" \
54+
--req_files='["_requirements/extra.txt"]'
55+
4456
- name: Install package & dependencies
4557
run: |
58+
set -e
4659
pip --version
4760
pip install -e '.[test,extra]' -U -q --find-links $TORCH_URL
4861
pip list
62+
# check that right package was installed
63+
python -c "import ${{matrix.dependency}}; print(${{matrix.dependency}}.__version__)"
4964
5065
- name: Tests with mocks
5166
run: |

src/litmodels/integrations/lightning_checkpoint.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
from lightning.pytorch import Trainer
1010
from lightning.pytorch.callbacks import ModelCheckpoint
1111
elif _PYTORCHLIGHTNING_AVAILABLE:
12-
from pytorch_lightning.callbacks import ModelCheckpoint, Trainer
12+
from pytorch_lightning import Trainer
13+
from pytorch_lightning.callbacks import ModelCheckpoint
1314
else:
1415
raise ModuleNotFoundError("No module named 'lightning' or 'pytorch_lightning'")
1516

0 commit comments

Comments
 (0)