diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b108119cf..725ab6562 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.9, '3.10', '3.11'] + python-version: [3.8, 3.9, '3.10', '3.11'] steps: - uses: actions/checkout@v3 diff --git a/environment.yml b/environment.yml index 98f49b9eb..fc602fa48 100644 --- a/environment.yml +++ b/environment.yml @@ -11,17 +11,18 @@ dependencies: - click>=8.1 - numpy~=1.23.0 - pillow~=9.2.0 - - scipy~=1.11.0 + - scipy~=1.10.0 - jinja2~=3.0 - conda-forge::torchvision-cpu>=0.5.0 - conda-forge::pytorch-cpu>=1.11,<1.14 - jsonschema - scikit-learn~=1.2.1 - - scikit-image~=0.21.0 + - scikit-image~=0.22.0 - shapely~=1.8.5 - pyvips - imagemagick>=7.1.0 - pyarrow + - importlib-resources>=1.3.0 - conda-forge::pytorch-lightning~=2.0.0 - conda-forge::torchmetrics>=1.1.0 - conda-forge::threadpoolctl~=3.2 diff --git a/environment_cuda.yml b/environment_cuda.yml index f492c0443..ca671c7de 100644 --- a/environment_cuda.yml +++ b/environment_cuda.yml @@ -11,18 +11,19 @@ dependencies: - click>=8.1 - numpy~=1.23 - pillow>=9.2.0 - - scipy~=1.11.0 + - scipy~=1.10.0 - jinja2~=3.0 - conda-forge::torchvision - conda-forge::pytorch>=1.11,<1.14 - cudatoolkit>=9.2 - jsonschema - scikit-learn~=1.2.1 - - scikit-image~=0.21.0 + - scikit-image~=0.22.0 - shapely~=1.8.5 - pyvips - imagemagick>=7.1.0 - pyarrow + - importlib-resources>=1.3.0 - conda-forge::pytorch-lightning~=2.0.0 - conda-forge::torchmetrics>=1.1.0 - conda-forge::threadpoolctl~=3.2 diff --git a/kraken/blla.py b/kraken/blla.py index cd9486de9..9c9054af4 100644 --- a/kraken/blla.py +++ b/kraken/blla.py @@ -25,7 +25,7 @@ import torch import logging import numpy as np -import importlib.resources +import importlib_resources import shapely.geometry as geom import torch.nn.functional as F import torchvision.transforms as tf @@ -310,7 +310,7 @@ def segment(im: PIL.Image.Image, """ if model is None: logger.info('No segmentation model given. Loading default model.') - model = vgsl.TorchVGSLModel.load_model(importlib.resources.files(__name__).joinpath('blla.mlmodel')) + model = vgsl.TorchVGSLModel.load_model(importlib_resources.files(__name__).joinpath('blla.mlmodel')) if isinstance(model, vgsl.TorchVGSLModel): model = [model] diff --git a/kraken/ketos/repo.py b/kraken/ketos/repo.py index 17b4ee8cc..d977d947d 100644 --- a/kraken/ketos/repo.py +++ b/kraken/ketos/repo.py @@ -43,7 +43,7 @@ def publish(ctx, metadata, access_token, private, model): Publishes a model on the zenodo model repository. """ import json - import importlib.resources + import importlib_resources from jsonschema import validate from jsonschema.exceptions import ValidationError @@ -52,7 +52,7 @@ def publish(ctx, metadata, access_token, private, model): from kraken.lib import models from kraken.lib.progress import KrakenDownloadProgressBar - ref = importlib.resources.files('kraken').joinpath('metadata.schema.json') + ref = importlib_resources.files('kraken').joinpath('metadata.schema.json') with open(ref, 'rb') as fp: schema = json.load(fp) diff --git a/kraken/kraken.py b/kraken/kraken.py index d269cc7c8..8e31d29ad 100644 --- a/kraken/kraken.py +++ b/kraken/kraken.py @@ -23,7 +23,7 @@ import warnings import logging import dataclasses -import importlib.resources +import importlib_resources from PIL import Image from pathlib import Path @@ -45,7 +45,7 @@ install(suppress=[click]) APP_NAME = 'kraken' -SEGMENTATION_DEFAULT_MODEL = importlib.resources.files(APP_NAME).joinpath('blla.mlmodel') +SEGMENTATION_DEFAULT_MODEL = importlib_resources.files(APP_NAME).joinpath('blla.mlmodel') DEFAULT_MODEL = ['en_best.mlmodel'] # raise default max image size to 20k * 20k pixels diff --git a/kraken/lib/dataset/utils.py b/kraken/lib/dataset/utils.py index 7e5d808ff..b690fdabf 100644 --- a/kraken/lib/dataset/utils.py +++ b/kraken/lib/dataset/utils.py @@ -18,7 +18,7 @@ import json import torch import numbers -import importlib.resources +import importlib_resources import torch.nn.functional as F from functools import partial @@ -320,7 +320,7 @@ def compute_confusions(algn1: Sequence[str], algn2: Sequence[str]): script substitutions. """ counts: Dict[Tuple[str, str], int] = Counter() - ref = importlib.resources.files(__name__).joinpath('scripts.json') + ref = importlib_resources.files(__name__).joinpath('scripts.json') with ref.open('rb') as fp: script_map = json.load(fp) diff --git a/setup.cfg b/setup.cfg index de5ed343a..3a802ada3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,6 +14,7 @@ classifier = Intended Audience :: Science/Research License :: OSI Approved :: Apache Software License Operating System :: POSIX + Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 @@ -37,7 +38,7 @@ max_line_length = 160 exclude = tests/* [options] -python_requires = >=3.9,<=3.11.99 +python_requires = >=3.8,<=3.11.99 install_requires = jsonschema lxml @@ -46,7 +47,7 @@ install_requires = numpy~=1.23.0 Pillow>=9.2.0 regex - scipy~=1.11.0 + scipy~=1.10.0 # bump up to latest release with py3.8 EOL protobuf>=3.0.0 coremltools~=6.0 jinja2~=3.0 @@ -54,12 +55,13 @@ install_requires = torchvision>=0.5.0 torch~=2.0.1 scikit-learn~=1.2.1 - scikit-image~=0.21.0 + scikit-image~=0.22.0 shapely~=1.8.5 pyarrow pytorch-lightning~=2.0.0 torchmetrics>=1.1.0 threadpoolctl~=3.2.0 + importlib-resources>=1.3.0 rich [options.extras_require]