Skip to content

Commit

Permalink
Merge branch 'main' into drop-deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Feb 19, 2024
2 parents 98abd21 + dfcc558 commit 74d7935
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 45 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -69,17 +68,14 @@ 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"]

# 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
Expand Down
7 changes: 5 additions & 2 deletions src/nd2/__init__.py
Original file line number Diff line number Diff line change
@@ -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__ = [
Expand Down
6 changes: 4 additions & 2 deletions src/nd2/_sdk_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/nd2/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions src/nd2/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions src/nd2/nd2file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 1 addition & 3 deletions src/nd2/readers/_legacy/legacy_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/nd2/readers/_modern/modern_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/nd2/readers/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/nd2/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions tests/test_aicsimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
It may need updating if it changes upstream
"""

import sys
from pathlib import Path
from typing import List, Optional, Tuple

Expand All @@ -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",
Expand Down
5 changes: 1 addition & 4 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 74d7935

Please sign in to comment.