Skip to content

Commit 23c8ff5

Browse files
authored
BREAK: drop support for Python 3.9 (#552)
* ENH: set `zip(..., strict=True)`
1 parent 79dfaa3 commit 23c8ff5

18 files changed

Lines changed: 199 additions & 1421 deletions

File tree

benchmarks/ampform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from collections.abc import Sequence
44
from pprint import pprint
5-
from typing import TYPE_CHECKING, Union
5+
from typing import TYPE_CHECKING
66

77
import numpy as np
88
import pytest
@@ -31,7 +31,7 @@
3131
ParametrizedFunction,
3232
)
3333

34-
StateDefinition = Union[str, tuple[str, Sequence[float]]]
34+
StateDefinition = str | tuple[str, Sequence[float]]
3535

3636

3737
def formulate_amplitude_model(

docs/amplitude-analysis.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@
765765
" density=True,\n",
766766
")\n",
767767
"ax.set_xlabel(\"$m$ [GeV]\")\n",
768-
"for p, color in zip(resonances, colors):\n",
768+
"for p, color in zip(resonances, colors, strict=True):\n",
769769
" ax.axvline(x=p.mass, linestyle=\"dotted\", label=p.name, color=color)\n",
770770
"ax.legend()\n",
771771
"plt.show()"
@@ -1476,7 +1476,7 @@
14761476
"\n",
14771477
"def indicate_masses(ax):\n",
14781478
" ax.set_xlabel(\"$m$ [GeV]\")\n",
1479-
" for color, resonance in zip(colors, resonances):\n",
1479+
" for color, resonance in zip(colors, resonances, strict=True):\n",
14801480
" ax.axvline(\n",
14811481
" x=resonance.mass,\n",
14821482
" linestyle=\"dotted\",\n",

docs/amplitude-analysis/analytic-continuation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
"\n",
256256
"fig, ax = plt.subplots()\n",
257257
"ax.set_xlabel(\"$m_{02}$ [GeV]\")\n",
258-
"for p, color in zip(resonances, colors):\n",
258+
"for p, color in zip(resonances, colors, strict=True):\n",
259259
" ax.axvline(x=p.mass, linestyle=\"dotted\", label=p.name, color=color)\n",
260260
"ax.set_yticks([])\n",
261261
"ax.hist(phsp[\"m_01\"], bins=100, alpha=0.5, weights=intensities)\n",

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ classifiers = [
1919
"Programming Language :: Python :: 3.11",
2020
"Programming Language :: Python :: 3.12",
2121
"Programming Language :: Python :: 3.13",
22-
"Programming Language :: Python :: 3.9",
2322
"Programming Language :: Python",
2423
"Topic :: Scientific/Engineering :: Physics",
2524
"Topic :: Scientific/Engineering",
@@ -32,7 +31,6 @@ dependencies = [
3231
"numpy",
3332
"sympy >=1.9", # lambdify cse
3433
"tqdm >=4.24.0", # autonotebook
35-
'typing-extensions; python_version < "3.10"',
3634
]
3735
description = "Python fitter package for multiple computational back-ends"
3836
dynamic = ["version"]
@@ -48,7 +46,7 @@ keywords = [
4846
license = {file = "LICENSE"}
4947
maintainers = [{email = "compwa-admin@ep1.rub.de"}]
5048
name = "tensorwaves"
51-
requires-python = ">=3.9"
49+
requires-python = ">=3.10"
5250

5351
[project.optional-dependencies]
5452
jax = [
@@ -372,7 +370,6 @@ positional = true
372370
[tool.poe.tasks.test-all]
373371
help = "Run all tests on each supported Python version"
374372
sequence = [
375-
{ref = "test-py 3.9"},
376373
{ref = "test-py 3.10"},
377374
{ref = "test-py 3.11"},
378375
{ref = "test-py 3.12"},

src/tensorwaves/data/_data_sample.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
from __future__ import annotations
44

55
import operator
6-
from typing import TYPE_CHECKING, Any, Callable
6+
from typing import TYPE_CHECKING, Any
77

88
import numpy as np
99

1010
if TYPE_CHECKING:
11+
from collections.abc import Callable
12+
1113
from tqdm.auto import tqdm
1214

1315
from tensorwaves.interface import DataSample

src/tensorwaves/data/rng.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import TYPE_CHECKING, Optional, Union
5+
from typing import TYPE_CHECKING
66

77
import numpy as np
88

@@ -12,7 +12,7 @@
1212
if TYPE_CHECKING: # pragma: no cover
1313
import tensorflow as tf
1414

15-
SeedLike = Optional[Union[int, tf.random.Generator]]
15+
SeedLike = int | tf.random.Generator | None
1616

1717

1818
class NumpyUniformRNG(RealNumberGenerator):

src/tensorwaves/estimator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import annotations
77

8-
from typing import TYPE_CHECKING, Callable
8+
from typing import TYPE_CHECKING
99

1010
from tensorwaves.data.transform import SympyDataTransformer
1111
from tensorwaves.function._backend import find_function, raise_missing_module_error
@@ -19,7 +19,7 @@
1919
)
2020

2121
if TYPE_CHECKING:
22-
from collections.abc import Iterable, Mapping
22+
from collections.abc import Callable, Iterable, Mapping
2323

2424
import numpy as np
2525
import sympy as sp

src/tensorwaves/function/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
import inspect
6-
from typing import TYPE_CHECKING, Callable
6+
from typing import TYPE_CHECKING
77

88
import attrs
99
import numpy as np
@@ -17,7 +17,7 @@
1717
)
1818

1919
if TYPE_CHECKING:
20-
from collections.abc import Iterable, Mapping
20+
from collections.abc import Callable, Iterable, Mapping
2121

2222

2323
def _all_str(

src/tensorwaves/function/_backend.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@
33
from __future__ import annotations
44

55
from functools import partial
6-
from typing import TYPE_CHECKING, Callable
6+
from typing import TYPE_CHECKING
77
from warnings import warn
88

99
if TYPE_CHECKING:
10-
import sys
11-
from typing import TypeVar
12-
13-
if sys.version_info >= (3, 10):
14-
from typing import ParamSpec
15-
else:
16-
from typing_extensions import ParamSpec
10+
from collections.abc import Callable
11+
from typing import ParamSpec, TypeVar
1712

1813
P = ParamSpec("P")
1914
T = TypeVar("T")

src/tensorwaves/function/sympy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
import logging
6-
from typing import TYPE_CHECKING, Any, Callable
6+
from typing import TYPE_CHECKING, Any
77

88
from tqdm.auto import tqdm
99

@@ -15,7 +15,7 @@
1515
)
1616

1717
if TYPE_CHECKING: # pragma: no cover
18-
from collections.abc import Generator, Iterable, Mapping, Sequence
18+
from collections.abc import Callable, Generator, Iterable, Mapping, Sequence
1919

2020
import sympy as sp
2121
from sympy.printing.printer import Printer

0 commit comments

Comments
 (0)