Skip to content

Commit

Permalink
Support python 3.12 (#1648)
Browse files Browse the repository at this point in the history
  • Loading branch information
MalteEbner authored Sep 17, 2024
1 parent 7c202bd commit 1c76372
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $LATEST_TAG
echo "tag_name=$LATEST_TAG" >> $GITHUB_OUTPUT;
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Build and release
id: build_and_release
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.7", "3.10"]
python: ["3.7", "3.12"]

steps:
- name: Checkout Code
Expand All @@ -59,15 +59,15 @@ jobs:
source .venv/bin/activate
export LIGHTLY_SERVER_LOCATION="localhost:-1"
python -m pytest -s -v --runslow --ignore=./lightly/openapi_generated/
- name: Run Pytest with Coverage (Python 3.10)
if: matrix.python == '3.10'
- name: Run Pytest with Coverage (Python 3.12)
if: matrix.python == '3.12'
run: |
source .venv/bin/activate
export LIGHTLY_SERVER_LOCATION="localhost:-1"
uv pip install pytest-cov==5.0.0
python -m pytest -s -v --runslow --cov=./lightly --cov-report=xml --ignore=./lightly/openapi_generated/
- name: Upload Coverage to Codecov
if: matrix.python == '3.10'
if: matrix.python == '3.12'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_api_deps_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Set Up Environment
run: |
make install-uv reset-venv
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/weekly_dependency_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Set Up Environment
run: |
make install-uv reset-venv
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
]
dependencies = [
Expand Down
6 changes: 3 additions & 3 deletions tests/api/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def test_download_all_video_frames(self):
def test_download_all_video_frames_timeout(self):
with tempfile.NamedTemporaryFile(suffix=".avi") as file:
_generate_video(file.name)
with self.assertRaisesRegexp(
with self.assertRaisesRegex(
RuntimeError,
"Maximum retries exceeded.*av.error.ExitError.*Immediate exit requested.*",
):
Expand Down Expand Up @@ -237,7 +237,7 @@ def test_download_video_frames_at_timestamps_timeout(self):
with tempfile.NamedTemporaryFile(suffix=".avi") as file:
n_frames = 5
_generate_video(file.name, n_frames)
with self.assertRaisesRegexp(
with self.assertRaisesRegex(
RuntimeError,
"Maximum retries exceeded.*av.error.ExitError.*Immediate exit requested.*",
):
Expand Down Expand Up @@ -436,7 +436,7 @@ def test_download_video_frame_count(self):
def test_download_video_Frame_count_timeout(self):
with tempfile.NamedTemporaryFile(suffix=".avi") as file:
_generate_video(file.name)
with self.assertRaisesRegexp(
with self.assertRaisesRegex(
RuntimeError,
"Maximum retries exceeded.*av.error.ExitError.*Immediate exit requested.*",
):
Expand Down
4 changes: 2 additions & 2 deletions tests/loss/test_DINOLoss.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ def test(
for param, orig_param in zip(
student.parameters(), orig_student.parameters()
):
self.assertTrue(torch.allclose(param, orig_param))
torch.testing.assert_close(param, orig_param)
for param, orig_param in zip(
teacher.parameters(), orig_teacher.parameters()
):
self.assertTrue(torch.allclose(param, orig_param))
torch.testing.assert_close(param, orig_param)

def test_all(**kwargs):
"""Tests all combinations of the input parameters"""
Expand Down
2 changes: 1 addition & 1 deletion tests/loss/test_VICRegLoss.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_forward__compare_vicregl(self) -> None:
loss = VICRegLoss(nu_param=0.5)
x0 = torch.randn((2, 10, 32))
x1 = torch.randn((2, 10, 32))
assert loss(x0, x1).item() == _reference_vicregl_vicreg_loss(x0, x1).item()
torch.testing.assert_close(loss(x0, x1), _reference_vicregl_vicreg_loss(x0, x1))


def _reference_vicreg_loss(
Expand Down

0 comments on commit 1c76372

Please sign in to comment.