diff --git a/.github/workflows/pr_test_cpu.yml b/.github/workflows/pr_test_cpu.yml index 5119de710e..97a40393d2 100644 --- a/.github/workflows/pr_test_cpu.yml +++ b/.github/workflows/pr_test_cpu.yml @@ -20,32 +20,34 @@ jobs: os: ['Ubuntu-latest', 'Windows-latest'] pytorch-dtype: ['float32', 'float64'] - uses: kornia/workflows/.github/workflows/tests.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0 with: os: ${{ matrix.os }} - python-version: '["3.8", "3.11"]' + python-version: '["3.8", "3.12"]' pytorch-version: '["1.9.1", "2.3.1"]' pytorch-dtype: ${{ matrix.pytorch-dtype }} tests-cpu-macos: - uses: kornia/workflows/.github/workflows/tests.yml@v1.6.0 + uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0 with: os: 'MacOS-latest' - python-version: '["3.8", "3.11"]' + python-version: '["3.8", "3.12"]' pytorch-dtype: 'float32' coverage: - uses: kornia/workflows/.github/workflows/coverage.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/coverage.yml@v1.10.0 typing: - uses: kornia/workflows/.github/workflows/mypy.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/mypy.yml@v1.10.0 tutorials: - uses: kornia/workflows/.github/workflows/tutorials.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/tutorials.yml@v1.10.0 docs: - uses: kornia/workflows/.github/workflows/docs.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/docs.yml@v1.10.0 + with: + python-version: "3.11" collector: needs: [coverage, tests-cpu, tutorials, typing, docs] @@ -66,7 +68,7 @@ jobs: os: ['Ubuntu-latest', 'Windows-latest'] #, 'MacOS-latest'] add it when https://github.com/pytorch/pytorch/pull/89262 be merged pytorch-dtype: ['float32', 'float64'] - uses: kornia/workflows/.github/workflows/tests.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0 with: os: ${{ matrix.os }} pytorch-version: '["nightly"]' diff --git a/.github/workflows/scheduled_test_cpu.yml b/.github/workflows/scheduled_test_cpu.yml index 9d4d51b1a7..18d037fd92 100644 --- a/.github/workflows/scheduled_test_cpu.yml +++ b/.github/workflows/scheduled_test_cpu.yml @@ -18,10 +18,10 @@ jobs: # os: ['Ubuntu-latest', 'Windows-latest', 'MacOS-latest'] pytorch-dtype: ['float32', 'float64'] - uses: kornia/workflows/.github/workflows/tests.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0 with: os: 'Ubuntu-latest' - python-version: '["3.8", "3.9", "3.10", "3.11"]' + python-version: '["3.8", "3.9", "3.10", "3.11", "3.12"]' pytorch-version: '["1.9.1", "1.10.2", "1.11.0", "1.12.1", "1.13.1", "2.0.1", "2.1.2", "2.2.2", "2.3.1"]' pytorch-dtype: ${{ matrix.pytorch-dtype }} pytest-extra: '--runslow' @@ -34,10 +34,10 @@ jobs: matrix: pytorch-dtype: ['float32', 'float64'] - uses: kornia/workflows/.github/workflows/tests.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0 with: os: 'Windows-latest' - python-version: '["3.11"]' + python-version: '["3.12"]' pytorch-version: '["1.9.1", "2.3.1"]' pytorch-dtype: ${{ matrix.pytorch-dtype }} @@ -47,19 +47,21 @@ jobs: matrix: pytorch-dtype: ['float32', 'float64'] - uses: kornia/workflows/.github/workflows/tests.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/tests.yml@v1.10.0 with: os: 'MacOS-latest' pytorch-dtype: ${{ matrix.pytorch-dtype }} coverage: - uses: kornia/workflows/.github/workflows/coverage.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/coverage.yml@v1.10.0 typing: - uses: kornia/workflows/.github/workflows/mypy.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/mypy.yml@v1.10.0 tutorials: - uses: kornia/workflows/.github/workflows/tutorials.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/tutorials.yml@v1.10.0 docs: - uses: kornia/workflows/.github/workflows/docs.yml@v1.9.1 + uses: kornia/workflows/.github/workflows/docs.yml@v1.10.0 + with: + python-version: "3.11" diff --git a/.github/workflows/scheduled_test_pypi_package.yml b/.github/workflows/scheduled_test_pypi_package.yml index 6392e0edba..f02c7aae99 100644 --- a/.github/workflows/scheduled_test_pypi_package.yml +++ b/.github/workflows/scheduled_test_pypi_package.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout kornia diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a7006790a..01c66aeeca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,19 +15,19 @@ repos: exclude: ^$|.devcontainer - repo: https://github.com/tox-dev/pyproject-fmt - rev: "2.1.1" + rev: "2.1.3" hooks: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.4 + rev: v0.4.9 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell args: diff --git a/conftest.py b/conftest.py index e7d00f6ab6..4c26edff0e 100644 --- a/conftest.py +++ b/conftest.py @@ -82,7 +82,10 @@ def torch_optimizer(optimizer_backend): return torch.jit.script if hasattr(torch, "compile") and sys.platform == "linux": - if not (sys.version_info[:2] == (3, 11) and torch_version() in {"2.0.0", "2.0.1"}): + if (not (sys.version_info[:2] == (3, 11) and torch_version() in {"2.0.0", "2.0.1"})) and ( + not sys.version_info[:2] == (3, 12) + ): + # torch compile don't have support for python3.12 yet torch._dynamo.reset() # torch compile just have support for python 3.11 after torch 2.1.0 return partial( @@ -182,7 +185,9 @@ def pytest_sessionstart(session): try: _setup_torch_compile() except RuntimeError as ex: - if "not yet supported for torch.compile" not in str(ex): + if "not yet supported for torch.compile" not in str( + ex + ) and "Dynamo is not supported on Python 3.12+" not in str(ex): raise ex # TODO: cache all torch.load weights/states here to not impact on test suite diff --git a/pyproject.toml b/pyproject.toml index ac956804ea..4b3b956921 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -159,6 +159,12 @@ lint.select = [ # "TD", # flake8-todos # "TRY", # tryceratops ] +lint.ignore = [ + "PLR0915", # Allow condition check in list comprehension + "PLW2901", # Allow overwritten values on loops + "UP007", # Prefer Optional[], Union[] over | due to torch jit scripting +] + lint.per-file-ignores."*/__init__.py" = [ "F401", "F403", @@ -217,11 +223,6 @@ lint.pylint.max-args = 30 # Recommended: 5 lint.pylint.max-branches = 21 # Recommended: 12 lint.pylint.max-returns = 13 # Recommended: 6 lint.pylint.max-statements = 64 # Recommended: 50 -lint.ignore = [ - "PLR0915", # Allow condition check in list comprehension - "PLW2901", # Allow overwritten values on loops - "UP007", # Prefer Optional[], Union[] over | due to torch jit scripting -] [tool.pytest.ini_options] addopts = "--color=yes"