Skip to content

Commit

Permalink
Merge pull request #270 from ap--/py313
Browse files Browse the repository at this point in the history
Py313
  • Loading branch information
ap-- authored Oct 29, 2024
2 parents 15f952b + 8d05d97 commit 05cfcff
Showing 14 changed files with 27 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/run_test_build_deploy.yaml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
@@ -44,10 +44,10 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9
- name: Setup libusb-dev
run: |
sudo apt-get install -y libusb-dev
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ repos:
hooks:
- id: flake8
additional_dependencies:
- flake8-typing-imports==1.14.0
- flake8-typing-imports==1.16.0
language_version: python3
exclude: "^(build|docs|tests|setup.py)"
- repo: https://github.com/pre-commit/mirrors-mypy
@@ -37,7 +37,7 @@ repos:
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.16.2
hooks:
2 changes: 1 addition & 1 deletion dev/pretty_print_obp_pcapng.py
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@

import enum
import struct
from collections.abc import Iterable
from typing import Any
from typing import Iterable

try:
from pcapng import FileScanner
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ requires = [
]

[tool.black]
target-version = ['py38']
target-version = ['py39']
include = '\.pyi?$'
exclude = '''
(
@@ -27,7 +27,7 @@ exclude = '''

[tool.isort]
profile = "black"
py_version = "38"
py_version = "39"
force_single_line = true

[tool.cibuildwheel]
@@ -45,7 +45,7 @@ test-command = [
before-build = "yum install -y libusb-devel"

[tool.mypy]
python_version = "3.8"
python_version = "3.9"
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -216,7 +216,7 @@ def win_spawn(_, cmd, *args, **kwargs):
"pytest>=6.2.4; python_version>'3.9'",
],
},
python_requires=">=3.8",
python_requires=">=3.9",
cmdclass={"build_ext": sb_build_ext},
ext_modules=extensions,
packages=find_packages(where="src"),
@@ -232,10 +232,10 @@ def win_spawn(_, cmd, *args, **kwargs):
long_description_content_type="text/markdown",
classifiers=[
"Programming Language :: Python :: 3",
"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",
"Programming Language :: Python :: 3.13",
],
)
3 changes: 1 addition & 2 deletions src/seabreeze/backends.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
import sys
import warnings
from typing import Any
from typing import Dict
from typing import Literal
from typing import Optional
from typing import cast
@@ -18,7 +17,7 @@ class BackendConfig:
requested = "cseabreeze" # default is cseabreeze
available = ("cseabreeze", "pyseabreeze")
allow_fallback = False
api_kwargs: Dict[str, Any] = {} # for pytests
api_kwargs: dict[str, Any] = {} # for pytests


def use(
2 changes: 1 addition & 1 deletion src/seabreeze/pyseabreeze/config.py
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
from __future__ import annotations

import os
from collections.abc import Iterator
from contextlib import contextmanager
from typing import Callable
from typing import Iterator
from typing import TypeVar

__all__ = [
5 changes: 2 additions & 3 deletions src/seabreeze/pyseabreeze/devices.py
Original file line number Diff line number Diff line change
@@ -8,9 +8,8 @@
import enum
import itertools
from collections import defaultdict
from collections.abc import Iterable
from typing import Any
from typing import Iterable
from typing import Tuple
from typing import TypeVar

from seabreeze.pyseabreeze import features as sbf
@@ -242,7 +241,7 @@ def __init__(
self.secondary_in2 = self.highspeed_in2 = highspeed_in2


class DarkPixelIndices(Tuple[int, ...]):
class DarkPixelIndices(tuple[int, ...]):
"""internal dark pixel range class"""

def __new__(
8 changes: 3 additions & 5 deletions src/seabreeze/pyseabreeze/features/introspection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Tuple

from seabreeze.pyseabreeze.features._base import SeaBreezeFeature


@@ -14,11 +12,11 @@ class SeaBreezeIntrospectionFeature(SeaBreezeFeature):
def number_of_pixels(self) -> int:
raise NotImplementedError("implement in derived class")

def get_active_pixel_ranges(self) -> Tuple[Tuple[int, int], ...]:
def get_active_pixel_ranges(self) -> tuple[tuple[int, int], ...]:
raise NotImplementedError("implement in derived class")

def get_optical_dark_pixel_ranges(self) -> Tuple[Tuple[int, int], ...]:
def get_optical_dark_pixel_ranges(self) -> tuple[tuple[int, int], ...]:
raise NotImplementedError("implement in derived class")

def get_electric_dark_pixel_ranges(self) -> Tuple[Tuple[int, int], ...]:
def get_electric_dark_pixel_ranges(self) -> tuple[tuple[int, int], ...]:
raise NotImplementedError("implement in derived class")
9 changes: 4 additions & 5 deletions src/seabreeze/pyseabreeze/features/nonlinearity.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import struct
from typing import List

from seabreeze.pyseabreeze.features._base import SeaBreezeFeature
from seabreeze.pyseabreeze.features.eeprom import SeaBreezeEEPromFeatureOOI
@@ -14,7 +13,7 @@
class SeaBreezeNonlinearityCoefficientsFeature(SeaBreezeFeature):
identifier = "nonlinearity_coefficients"

def get_nonlinearity_coefficients(self) -> List[float]:
def get_nonlinearity_coefficients(self) -> list[float]:
raise NotImplementedError("implement in derived class")


@@ -27,7 +26,7 @@ class NonlinearityCoefficientsEEPromFeatureOOI(
_required_protocol_cls = OOIProtocol
_required_features = ("eeprom",)

def get_nonlinearity_coefficients(self) -> List[float]:
def get_nonlinearity_coefficients(self) -> list[float]:
# The spectrometers store the wavelength calibration in slots 6..13
coeffs = []
# noinspection PyProtectedMember
@@ -50,7 +49,7 @@ def get_nonlinearity_coefficients(self) -> List[float]:
class NonlinearityCoefficientsFeatureOBP(SeaBreezeNonlinearityCoefficientsFeature):
_required_protocol_cls = OBPProtocol

def get_nonlinearity_coefficients(self) -> List[float]:
def get_nonlinearity_coefficients(self) -> list[float]:
# get number of nonlinearity coefficients
data = self.protocol.query(0x00181100)
N = struct.unpack("<B", data)[0]
@@ -65,7 +64,7 @@ def get_nonlinearity_coefficients(self) -> List[float]:
class NonlinearityCoefficientsFeatureOBP2(SeaBreezeNonlinearityCoefficientsFeature):
_required_protocol_cls = OBP2Protocol

def get_nonlinearity_coefficients(self) -> List[float]:
def get_nonlinearity_coefficients(self) -> list[float]:
# get nonlinearity coefficients
data = self.protocol.query(0x000_012_00)
num_coeffs = len(data) // 4
4 changes: 1 addition & 3 deletions src/seabreeze/pyseabreeze/features/straylightcoefficients.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List

from seabreeze.pyseabreeze.features._base import SeaBreezeFeature


@@ -11,5 +9,5 @@
class SeaBreezeStrayLightCoefficientsFeature(SeaBreezeFeature):
identifier = "stray_light_coefficients"

def get_stray_light_coefficients(self) -> List[float]:
def get_stray_light_coefficients(self) -> list[float]:
raise NotImplementedError("implement in derived class")
4 changes: 1 addition & 3 deletions src/seabreeze/pyseabreeze/features/temperature.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List

from seabreeze.pyseabreeze.features._base import SeaBreezeFeature


@@ -17,5 +15,5 @@ def count_temperatures(self) -> int:
def read_temperature(self, index: int) -> float:
raise NotImplementedError("implement in derived class")

def temperature_get_all(self) -> List[float]:
def temperature_get_all(self) -> list[float]:
raise NotImplementedError("implement in derived class")
5 changes: 2 additions & 3 deletions src/seabreeze/pyseabreeze/transport.py
Original file line number Diff line number Diff line change
@@ -14,11 +14,10 @@
import struct
import warnings
import weakref
from collections.abc import Iterable
from functools import partialmethod
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterable
from typing import Tuple

import usb.backend
import usb.core
@@ -50,7 +49,7 @@ class USBTransportDeviceInUse(Exception):
pass


DeviceIdentity = Tuple[int, int, int, int]
DeviceIdentity = tuple[int, int, int, int]


# this can and should be opaque to pyseabreeze
2 changes: 1 addition & 1 deletion src/seabreeze/pyseabreeze/types.py
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
import weakref
from abc import ABC
from abc import abstractmethod
from collections.abc import Iterable
from typing import Any
from typing import Generic
from typing import Iterable
from typing import TypeVar


0 comments on commit 05cfcff

Please # to comment.