Skip to content

Commit

Permalink
tiffslide: drop python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed Jul 9, 2023
1 parent 63c86e9 commit 90dd78e
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 229 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/run_pytests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ jobs:
python-version: "3.9"
- os: ubuntu-latest
python-version: "3.8"
- os: ubuntu-latest
python-version: "3.7"
steps:
- name: Checkout TiffSlide
uses: actions/checkout@v3
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ repos:
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.9.0
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.0.1'
rev: 'v1.4.1'
hooks:
- id: mypy
additional_dependencies: ["numpy"]
exclude: ^examples/
exclude: ^examples/|^tiffslide/tests/
- repo: https://github.com/PyCQA/flake8
rev: '6.0.0'
hooks:
Expand All @@ -34,7 +34,7 @@ repos:
language_version: python3
exclude: "^(build|docs|setup.py)|tests[/]"
- repo: https://github.com/PyCQA/bandit
rev: '1.7.4'
rev: '1.7.5'
hooks:
- id: bandit
args: ["--ini", ".bandit", "-lll"]
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ classifiers =
License :: OSI Approved :: BSD License
Programming Language :: Python
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Information Analysis
Topic :: Scientific/Engineering :: Bio-Informatics
Expand All @@ -32,7 +32,7 @@ classifiers =

[options]
packages = find:
python_requires = >=3.7
python_requires = >=3.8
install_requires =
imagecodecs
fsspec!=2022.11.0,!=2023.1.0
Expand Down
6 changes: 1 addition & 5 deletions tiffslide/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@
from types import TracebackType
from typing import TYPE_CHECKING
from typing import Any
from typing import Literal
from typing import Mapping
from typing import Sequence

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal

import numpy as np
import zarr
from imagecodecs import __version__ as _imagecodecs_version
Expand Down
6 changes: 1 addition & 5 deletions tiffslide/_kerchunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
from io import StringIO
from typing import TYPE_CHECKING
from typing import Any

if sys.version_info >= (3, 8):
from typing import TypedDict
else:
from typing_extensions import TypedDict
from typing import TypedDict

import fsspec
from imagecodecs.numcodecs import register_codecs
Expand Down
151 changes: 0 additions & 151 deletions tiffslide/_pycompat.py

This file was deleted.

13 changes: 3 additions & 10 deletions tiffslide/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@
from typing import IO
from typing import TYPE_CHECKING
from typing import Any
from typing import Protocol
from typing import TypedDict
from typing import Union

if sys.version_info >= (3, 8):
from typing import Protocol
from typing import TypedDict
from typing import runtime_checkable

else:
from typing_extensions import Protocol
from typing_extensions import TypedDict
from typing_extensions import runtime_checkable
from typing import runtime_checkable

if sys.version_info >= (3, 10):
from typing import TypeAlias
Expand Down
14 changes: 1 addition & 13 deletions tiffslide/_zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
from __future__ import annotations

import json
import sys
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterator
from typing import Mapping
from warnings import warn

import numpy as np
import zarr
Expand All @@ -19,8 +17,6 @@
from zarr.storage import FSStore

from tiffslide._compat import NotTiffFile
from tiffslide._pycompat import REQUIRES_STORE_FIX
from tiffslide._pycompat import py37_fix_store
from tiffslide._types import Point3D
from tiffslide._types import SeriesCompositionInfo
from tiffslide._types import Size3D
Expand All @@ -42,12 +38,6 @@
"get_zarr_selection",
]

if REQUIRES_STORE_FIX and sys.version_info >= (3, 8):
warn(
"detected outdated tifffile version on `python>=3.8` with `zarr>=2.11.0`: "
"updating tifffile is recommended!"
)


# --- zarr storage classes --------------------------------------------

Expand Down Expand Up @@ -120,8 +110,6 @@ def _get_series_zarr(
zstore = FSStore(f"s{series_idx}", fs=obj)
else:
raise NotImplementedError(f"{type(obj).__name__} unsupported")
if REQUIRES_STORE_FIX:
zstore = py37_fix_store(zstore)
return zstore # type: ignore


Expand Down Expand Up @@ -302,7 +290,7 @@ def get_zarr_chunk_sizes(
except AttributeError:
raise RuntimeError("probably not supported with your tifffile version")

chunk_sizes = np.full(chunked, dtype=np.int64, fill_value=-1)
chunk_sizes: NDArray[np.int64] = np.full(chunked, dtype=np.int64, fill_value=-1)

# _index = ""
for indices in np.ndindex(*chunked):
Expand Down
11 changes: 4 additions & 7 deletions tiffslide/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,10 @@ def gen_im(size_hw):
mpp = 0.25
mag = 40
filename = "ASD"
if sys.version_info >= (3, 8):
resolution_kw = {
"resolution": (10000 / mpp, 10000 / mpp),
"resolutionunit": "CENTIMETER",
}
else:
resolution_kw = {"resolution": (10000 / mpp, 10000 / mpp, "CENTIMETER")}
resolution_kw = {
"resolution": (10000 / mpp, 10000 / mpp),
"resolutionunit": "CENTIMETER",
}

# write to svs format
with tifffile.TiffWriter(pth, bigtiff=True) as tif:
Expand Down
17 changes: 0 additions & 17 deletions tiffslide/tests/test_pycompat.py

This file was deleted.

Loading

0 comments on commit 90dd78e

Please sign in to comment.