diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59ffad3..d3c7646 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,16 +30,7 @@ jobs: fail-fast: false matrix: platform: [macos-latest, windows-latest, "ubuntu-latest"] - python-version: ["3.9", "3.10", "3.11"] - include: - - python-version: "3.7" - platform: "ubuntu-latest" - - python-version: "3.8" - platform: "ubuntu-latest" - - python-version: "3.8" - platform: "windows-latest" - - python-version: "3.12-dev" - platform: "ubuntu-latest" + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index 6b7c4b2..ab37f5b 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -19,8 +19,6 @@ jobs: python-version: ['3.9', '3.10', '3.11'] platform: [ubuntu-latest, macos-latest, windows-latest] include: - - python-version: "3.7" - platform: "ubuntu-latest" - python-version: "3.8" platform: "ubuntu-latest" - python-version: "3.8" diff --git a/pyproject.toml b/pyproject.toml index 7e80ca3..6cf7345 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,14 +7,13 @@ build-backend = "hatchling.build" name = "nd2" description = "Yet another nd2 (Nikon NIS Elements) file reader" readme = "README.md" -requires-python = ">=3.7" +requires-python = ">=3.8" license = { text = "BSD 3-Clause License" } authors = [{ email = "talley.lambert@gmail.com", name = "Talley Lambert" }] classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -69,9 +68,6 @@ documentation = "https://tlambert03.github.io/nd2/" [tool.hatch.version] source = "vcs" -[tool.hatch.build.hooks.vcs] -version-file = "src/nd2/_version.py" - [tool.hatch.build.targets.wheel] only-include = ["src"] sources = ["src"] @@ -79,7 +75,7 @@ sources = ["src"] # https://beta.ruff.rs/docs/rules/ [tool.ruff] line-length = 88 -target-version = "py37" +target-version = "py38" src = ["src/nd2", "tests"] select = [ "E", # style errors diff --git a/src/nd2/__init__.py b/src/nd2/__init__.py index 440df98..b1c1d64 100644 --- a/src/nd2/__init__.py +++ b/src/nd2/__init__.py @@ -1,9 +1,12 @@ """nd2: A Python library for reading and writing ND2 files.""" +from importlib.metadata import PackageNotFoundError, version + try: - from ._version import version as __version__ -except ImportError: + __version__ = version(__name__) +except PackageNotFoundError: # pragma: no cover __version__ = "unknown" + __author__ = "Talley Lambert" __email__ = "talley.lambert@gmail.com" __all__ = [ diff --git a/src/nd2/_sdk_types.py b/src/nd2/_sdk_types.py index 444f60c..5587984 100644 --- a/src/nd2/_sdk_types.py +++ b/src/nd2/_sdk_types.py @@ -3,10 +3,12 @@ from __future__ import annotations from enum import IntEnum, auto -from typing import TYPE_CHECKING, Union +from typing import TYPE_CHECKING if TYPE_CHECKING: - from typing_extensions import Literal, NotRequired, TypeAlias, TypedDict + from typing import Literal, TypedDict, Union + + from typing_extensions import NotRequired, TypeAlias class RawAttributesDict(TypedDict, total=False): uiWidth: int diff --git a/src/nd2/_util.py b/src/nd2/_util.py index 9f099ee..11428cf 100644 --- a/src/nd2/_util.py +++ b/src/nd2/_util.py @@ -8,9 +8,7 @@ if TYPE_CHECKING: from os import PathLike - from typing import Any, Callable, ClassVar, Mapping, Sequence, Union - - from typing_extensions import Final + from typing import Any, Callable, ClassVar, Final, Mapping, Sequence, Union from nd2.structures import ExpLoop diff --git a/src/nd2/index.py b/src/nd2/index.py index fc80fbc..3e0de0b 100644 --- a/src/nd2/index.py +++ b/src/nd2/index.py @@ -7,9 +7,7 @@ from concurrent.futures import ThreadPoolExecutor from datetime import datetime from pathlib import Path -from typing import Any, Iterable, Iterator, Sequence, cast, no_type_check - -from typing_extensions import TypedDict +from typing import Any, Iterable, Iterator, Sequence, TypedDict, cast, no_type_check import nd2 diff --git a/src/nd2/nd2file.py b/src/nd2/nd2file.py index ccae92b..67fbc01 100644 --- a/src/nd2/nd2file.py +++ b/src/nd2/nd2file.py @@ -20,13 +20,12 @@ if TYPE_CHECKING: from pathlib import Path - from typing import Any, Sequence, Sized, SupportsInt + from typing import Any, Literal, Sequence, Sized, SupportsInt import dask.array import dask.array.core import xarray as xr from ome_types import OME - from typing_extensions import Literal from ._binary import BinaryLayers from ._util import ( diff --git a/src/nd2/readers/_legacy/legacy_reader.py b/src/nd2/readers/_legacy/legacy_reader.py index 1c962a1..9a0ed17 100644 --- a/src/nd2/readers/_legacy/legacy_reader.py +++ b/src/nd2/readers/_legacy/legacy_reader.py @@ -22,9 +22,7 @@ if TYPE_CHECKING: from collections import defaultdict - from typing import Any, BinaryIO, Mapping - - from typing_extensions import TypedDict + from typing import Any, BinaryIO, Mapping, TypedDict from nd2._util import FileOrBinaryIO diff --git a/src/nd2/readers/_modern/modern_reader.py b/src/nd2/readers/_modern/modern_reader.py index 26db21a..cd03035 100644 --- a/src/nd2/readers/_modern/modern_reader.py +++ b/src/nd2/readers/_modern/modern_reader.py @@ -31,8 +31,9 @@ if TYPE_CHECKING: import datetime from os import PathLike + from typing import Literal - from typing_extensions import Literal, TypeAlias + from typing_extensions import TypeAlias from nd2._binary import BinaryLayers from nd2._parse._chunk_decode import ChunkMap diff --git a/src/nd2/readers/protocol.py b/src/nd2/readers/protocol.py index 811dc4d..4c6a1ec 100644 --- a/src/nd2/readers/protocol.py +++ b/src/nd2/readers/protocol.py @@ -10,10 +10,9 @@ from nd2._parse._chunk_decode import get_version if TYPE_CHECKING: - from typing import Any, ContextManager, Mapping, Sequence + from typing import Any, ContextManager, Literal, Mapping, Sequence import numpy as np - from typing_extensions import Literal from nd2._binary import BinaryLayers from nd2._util import FileOrBinaryIO diff --git a/src/nd2/structures.py b/src/nd2/structures.py index c959a60..e818cb6 100644 --- a/src/nd2/structures.py +++ b/src/nd2/structures.py @@ -3,9 +3,7 @@ import builtins from dataclasses import dataclass, field from enum import IntEnum -from typing import TYPE_CHECKING, NamedTuple, Union - -from typing_extensions import Literal, TypedDict +from typing import TYPE_CHECKING, Literal, NamedTuple, TypedDict, Union from ._sdk_types import EventMeaning, StimulationType diff --git a/tests/test_aicsimage.py b/tests/test_aicsimage.py index 7a98fee..66f1ea8 100644 --- a/tests/test_aicsimage.py +++ b/tests/test_aicsimage.py @@ -4,7 +4,6 @@ It may need updating if it changes upstream """ -import sys from pathlib import Path from typing import List, Optional, Tuple @@ -18,7 +17,6 @@ DATA = Path(__file__).parent / "data" -@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python3.8 or higher") @pytest.mark.parametrize( ( "filename", diff --git a/tests/test_metadata.py b/tests/test_metadata.py index b41ad41..932b57b 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -3,7 +3,7 @@ import json import sys from pathlib import Path -from typing import TYPE_CHECKING, Any +from typing import Any, Literal import dask.array as da import pytest @@ -18,9 +18,6 @@ except ImportError: xr = None -if TYPE_CHECKING: - from typing_extensions import Literal - with open("tests/samples_metadata.json") as f: EXPECTED = json.load(f)