Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Py313 #270

Merged
merged 3 commits into from
Oct 29, 2024
Merged

Py313 #270

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/run_test_build_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion dev/pretty_print_obp_pcapng.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ requires = [
]

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

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

[tool.cibuildwheel]
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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
Expand Up @@ -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
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/seabreeze/pyseabreeze/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = [
Expand Down
5 changes: 2 additions & 3 deletions src/seabreeze/pyseabreeze/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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__(
Expand Down
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


Expand All @@ -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
Expand All @@ -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")


Expand All @@ -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
Expand All @@ -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]
Expand All @@ -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
Expand Down
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


Expand All @@ -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


Expand All @@ -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
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/seabreeze/pyseabreeze/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down