Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ jobs:
fail-fast: true
matrix:
include:
- dockerfile: ./docker/3.9/Debian/Dockerfile
mtag: py3.9-debian
- dockerfile: ./docker/3.9/Ubuntu/Dockerfile
mtag: py3.9-ubuntu
- dockerfile: ./docker/3.10/Debian/Dockerfile
mtag: py3.10-debian
- dockerfile: ./docker/3.10/Ubuntu/Dockerfile
Expand All @@ -31,7 +27,11 @@ jobs:
mtag: py3.12-debian
- dockerfile: ./docker/3.12/Ubuntu/Dockerfile
mtag: py3.12-ubuntu
- dockerfile: ./docker/3.12/Ubuntu/Dockerfile
- dockerfile: ./docker/3.13/Ubuntu/Dockerfile
mtag: py3.13-debian
- dockerfile: ./docker/3.13/Ubuntu/Dockerfile
mtag: py3.13-ubuntu
- dockerfile: ./docker/3.13/Ubuntu/Dockerfile
mtag: latest
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mypy-type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pip-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-24.04, windows-latest, macos-latest]
steps:
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the pull request description.
3. The pull request should work for Python 3.9, 3.10, 3.11, and 3.12, and for PyPy. Check https://github.com/TissueImageAnalytics/tiatoolbox/actions/workflows/python-package.yml and make sure that the tests pass for all supported Python versions.
3. The pull request should work for Python 3.10, 3.11, 3.12 and 3.13, and for PyPy. Check https://github.com/TissueImageAnalytics/tiatoolbox/actions/workflows/python-package.yml and make sure that the tests pass for all supported Python versions.

Tips
----
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Prepare a computer as a convenient platform for further development of the Pytho
5. Create virtual environment for TIAToolbox using

```sh
$ conda create -n tiatoolbox-dev python=3.9 # select version of your choice
$ conda create -n tiatoolbox-dev python=3.10 # select version of your choice
$ conda activate tiatoolbox-dev
$ pip install -r requirements/requirements_dev.txt
```
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/annotation_store.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
" capsize=capsize,\n",
" **kwargs,\n",
" )\n",
" for i, (runs, c) in enumerate(zip(experiments, color)):\n",
" for i, (runs, c) in enumerate(zip(experiments, color, strict=False)):\n",
" plt.text(\n",
" i,\n",
" min(runs),\n",
Expand Down Expand Up @@ -2418,7 +2418,7 @@
" )\n",
" total = np.sum(counts)\n",
" frequencies = dict.fromkeys(range(256), 0)\n",
" for v, x in zip(values, counts):\n",
" for v, x in zip(values, counts, strict=False):\n",
" frequencies[v] = x / total\n",
" frequency_array = np.array(list(frequencies.values()))\n",
" epsilon = 1e-16\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ MacPorts
Installing Stable Release
=========================

Please note that TIAToolbox is tested for Python versions 3.9, 3.10, 3.11, and 3.12.
Please note that TIAToolbox is tested for Python versions 3.10, 3.11, 3.12 and 3.13.

Recommended
-----------
Expand Down
18 changes: 9 additions & 9 deletions examples/full-pipelines/slide-graph.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"import warnings\n",
"from collections import OrderedDict\n",
"from pathlib import Path\n",
"from typing import TYPE_CHECKING, Callable\n",
"from typing import TYPE_CHECKING\n",
"\n",
"# Third party imports\n",
"import joblib\n",
Expand Down Expand Up @@ -192,7 +192,7 @@
")\n",
"\n",
"if TYPE_CHECKING: # pragma: no cover\n",
" from collections.abc import Iterator\n",
" from collections.abc import Callable, Iterator\n",
"\n",
"warnings.filterwarnings(\"ignore\")\n",
"mpl.rcParams[\"figure.dpi\"] = 300 # for high resolution figure in notebook"
Expand Down Expand Up @@ -394,7 +394,7 @@
"patient_uids = patient_uids[sel]\n",
"patient_labels = patient_labels_[sel]\n",
"assert len(patient_uids) == len(patient_labels) # noqa: S101\n",
"clinical_info = OrderedDict(list(zip(patient_uids, patient_labels)))\n",
"clinical_info = OrderedDict(list(zip(patient_uids, patient_labels, strict=False)))\n",
"\n",
"# Retrieve patient code of each WSI, this is based on TCGA barcodes:\n",
"# https://docs.gdc.cancer.gov/Encyclopedia/pages/TCGA_Barcode/\n",
Expand All @@ -412,7 +412,7 @@
"wsi_names = np.array(wsi_names)[sel]\n",
"wsi_labels = np.array(wsi_labels)[sel]\n",
"\n",
"label_df = list(zip(wsi_names, wsi_labels))\n",
"label_df = list(zip(wsi_names, wsi_labels, strict=False))\n",
"label_df = pd.DataFrame(label_df, columns=[\"WSI-CODE\", \"LABEL\"])"
]
},
Expand Down Expand Up @@ -529,9 +529,9 @@
"\n",
" splits.append(\n",
" {\n",
" \"train\": list(zip(train_x, train_y)),\n",
" \"valid\": list(zip(valid_x, valid_y)),\n",
" \"test\": list(zip(test_x, test_y)),\n",
" \"train\": list(zip(train_x, train_y, strict=False)),\n",
" \"valid\": list(zip(valid_x, valid_y, strict=False)),\n",
" \"test\": list(zip(test_x, test_y, strict=False)),\n",
" },\n",
" )\n",
" return splits"
Expand Down Expand Up @@ -2025,7 +2025,7 @@
" output = [np.split(v, batch_size, axis=0) for v in output]\n",
" # pairing such that it will be\n",
" # N batch size x H head list\n",
" output = list(zip(*output))\n",
" output = list(zip(*output, strict=False))\n",
" step_output.extend(output)\n",
" pbar.update()\n",
" pbar.close()\n",
Expand All @@ -2042,7 +2042,7 @@
" ):\n",
" # Expand the list of N dataset size x H heads\n",
" # back to a list of H Head each with N samples.\n",
" output = list(zip(*step_output))\n",
" output = list(zip(*step_output, strict=False))\n",
" logit, true = output\n",
" logit = np.squeeze(np.array(logit))\n",
" true = np.squeeze(np.array(true))\n",
Expand Down
4 changes: 3 additions & 1 deletion examples/inference-pipelines/slide-graph.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
"import shutil\n",
"import warnings\n",
"from pathlib import Path\n",
"from typing import TYPE_CHECKING, Callable\n",
"from typing import TYPE_CHECKING\n",
"\n",
"# Third party imports\n",
"import joblib\n",
Expand Down Expand Up @@ -260,6 +260,8 @@
"from tiatoolbox.wsicore.wsireader import WSIReader\n",
"\n",
"if TYPE_CHECKING:\n",
" from collections.abc import Callable\n",
"\n",
" from tiatoolbox.wsicore.wsimeta import Resolution, Units\n",
"\n",
"warnings.filterwarnings(\"ignore\")\n",
Expand Down
1 change: 1 addition & 0 deletions pre-commit/notebook_markdown_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def main(files: list[Path]) -> None:
for cell, formatted_cell in zip(
notebook["cells"],
formatted_notebook["cells"],
strict=False,
)
)
if not changed:
Expand Down
2 changes: 1 addition & 1 deletion pre-commit/requirements_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def in_common_consistent(all_requirements: dict[Path, dict[str, Requirement]]) -
]

# Unzip the specs to get a list of constraints and versions
_, constraints, versions = zip(*zipped_file_specs)
_, constraints, versions = zip(*zipped_file_specs, strict=False)

# Check that the constraints and versions are the same across files
formatted_reqs = [f"{c}{v} ({p.name})" for p, c, v in zipped_file_specs]
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ line-length = 88
# Allow unused variables when underscore-prefixed.
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Minimum Python version 3.9.
target-version = "py39"
# Minimum Python version 3.10.
target-version = "py310"

[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
Expand Down Expand Up @@ -174,4 +174,4 @@ skip-magic-trailing-comma = false

[tool.mypy]
ignore_missing_imports = true
python_version = 3.9
python_version = "3.10"
6 changes: 3 additions & 3 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# torch installation
--extra-index-url https://download.pytorch.org/whl/cu118; sys_platform != "darwin"
--extra-index-url https://download.pytorch.org/whl/cu126; sys_platform != "darwin"
aiohttp>=3.8.1
albumentations>=1.3.0
bokeh>=3.1.1, <3.6.0
Expand All @@ -8,13 +8,13 @@ defusedxml>=0.7.1
filelock>=3.9.0
flask>=2.2.2
flask-cors>=4.0.0
glymur>=0.12.7, < 0.14 # 0.14 is not compatible with python3.9
glymur>=0.12.7
imagecodecs>=2022.9.26
joblib>=1.1.1
jupyterlab>=3.5.2
matplotlib>=3.6.2
numba>=0.57.0
numpy>=1.23.5, <2.0.0
numpy>=2.0.0
opencv-python>=4.6.0
openslide-bin>=4.0.0.2
openslide-python>=1.4.0
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@
setup(
author="TIA Centre",
author_email="[email protected]",
python_requires=">=3.9, <3.13",
python_requires=">=3.10, <3.14",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
],
description="Computational pathology toolbox developed by TIA Centre.",
dependency_links=dependency_links,
Expand Down
5 changes: 4 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import shutil
import time
from pathlib import Path
from typing import Callable
from typing import TYPE_CHECKING

import pytest
import torch
Expand All @@ -16,6 +16,9 @@
from tiatoolbox.data import _fetch_remote_sample
from tiatoolbox.utils.env_detection import has_gpu, running_on_ci

if TYPE_CHECKING:
from collections.abc import Callable

# -------------------------------------------------------------------------------------
# Generate Parameterized Tests
# -------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_arch_mapde.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Unit test package for SCCNN."""

from typing import Callable
from collections.abc import Callable

import numpy as np
import torch
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_arch_micronet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Unit test package for MicroNet."""

from collections.abc import Callable
from pathlib import Path
from typing import Callable

import numpy as np
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_arch_nuclick.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Unit test package for NuClick."""

from collections.abc import Callable
from pathlib import Path
from typing import Callable

import numpy as np
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_arch_sccnn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Unit test package for SCCNN."""

from typing import Callable
from collections.abc import Callable

import numpy as np
import torch
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_arch_unet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Unit test package for Unet."""

from collections.abc import Callable
from pathlib import Path
from typing import Callable

import numpy as np
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_feature_extractor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Test for feature extractor."""

import shutil
from collections.abc import Callable
from pathlib import Path
from typing import Callable

import numpy as np
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_hovernet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Unit test package for HoVerNet."""

from typing import Callable
from collections.abc import Callable

import numpy as np
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_hovernetplus.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Unit test package for HoVerNet+."""

from typing import Callable
from collections.abc import Callable

import torch

Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_multi_task_segmentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import gc
import multiprocessing
import shutil
from collections.abc import Callable
from pathlib import Path
from typing import Callable

import joblib
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_nucleus_instance_segmentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# ! The garbage collector
import gc
import shutil
from collections.abc import Callable
from pathlib import Path
from typing import Callable

import joblib
import numpy as np
Expand Down
5 changes: 4 additions & 1 deletion tests/models/test_patch_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import copy
import shutil
from pathlib import Path
from typing import Callable
from typing import TYPE_CHECKING

import cv2
import numpy as np
Expand All @@ -28,6 +28,9 @@
from tiatoolbox.utils.misc import select_device
from tiatoolbox.wsicore.wsireader import WSIReader

if TYPE_CHECKING:
from collections.abc import Callable

ON_GPU = toolbox_env.has_gpu()
RNG = np.random.default_rng() # Numpy Random Generator

Expand Down
Loading
Loading