diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt deleted file mode 100644 index a39ad9f1..00000000 --- a/.constraints/py3.8.txt +++ /dev/null @@ -1,254 +0,0 @@ -# This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml -o .constraints/py3.8.txt --all-extras --no-annotate --python-version=3.8 --no-emit-package setuptools -absl-py==2.1.0 -accessible-pygments==0.0.4 -alabaster==0.7.13 -ampform==0.15.4 -anyio==4.4.0 -argon2-cffi==23.1.0 -argon2-cffi-bindings==21.2.0 -arrow==1.3.0 -asttokens==2.4.1 -astunparse==1.6.3 -async-lru==2.0.4 -attrs==24.2.0 -babel==2.16.0 -backcall==0.2.0 -beautifulsoup4==4.12.3 -bleach==6.1.0 -cachetools==5.5.0 -cattrs==24.1.0 -certifi==2024.8.30 -cffi==1.17.1 -cfgv==3.4.0 -chardet==5.2.0 -charset-normalizer==3.3.2 -click==8.1.7 -cloudpickle==3.0.0 -colorama==0.4.6 -comm==0.2.2 -contourpy==1.1.1 -coverage==7.6.1 -cycler==0.12.1 -debugpy==1.8.5 -decorator==5.1.1 -defusedxml==0.7.1 -distlib==0.3.8 -dm-tree==0.1.8 -docstring-to-markdown==0.15 -docutils==0.19 -exceptiongroup==1.2.2 -execnet==2.1.1 -executing==2.1.0 -fastjsonschema==2.20.0 -filelock==3.16.0 -flatbuffers==24.3.25 -fonttools==4.53.1 -fqdn==1.5.1 -gast==0.4.0 -gitdb==4.0.11 -gitpython==3.1.43 -google-auth==2.34.0 -google-auth-oauthlib==0.4.6 -google-pasta==0.2.0 -graphviz==0.20.3 -greenlet==3.1.0 -grpcio==1.66.1 -h11==0.14.0 -h5py==3.11.0 -hepunits==2.3.4 -httpcore==1.0.5 -httpx==0.27.2 -identify==2.6.0 -idna==3.8 -imagesize==1.4.1 -iminuit==2.27.0 -importlib-metadata==8.4.0 -importlib-resources==6.4.5 -iniconfig==2.0.0 -ipykernel==6.29.5 -ipympl==0.9.3 -ipython==8.12.3 -ipython-genutils==0.2.0 -ipywidgets==8.1.5 -isoduration==20.11.0 -jax==0.4.13 -jaxlib==0.4.13 -jedi==0.19.1 -jinja2==3.1.4 -json5==0.9.25 -jsonpointer==3.0.0 -jsonschema==4.23.0 -jsonschema-specifications==2023.12.1 -jupyter==1.1.1 -jupyter-cache==0.6.1 -jupyter-client==8.6.2 -jupyter-console==6.6.3 -jupyter-core==5.7.2 -jupyter-events==0.10.0 -jupyter-lsp==2.2.5 -jupyter-server==2.14.2 -jupyter-server-mathjax==0.2.6 -jupyter-server-terminals==0.5.3 -jupyterlab==4.2.5 -jupyterlab-code-formatter==3.0.2 -jupyterlab-git==0.50.1 -jupyterlab-lsp==5.1.0 -jupyterlab-myst==2.4.2 -jupyterlab-pygments==0.3.0 -jupyterlab-server==2.27.3 -jupyterlab-widgets==3.0.13 -keras==2.11.0 -kiwisolver==1.4.7 -libclang==18.1.1 -livereload==2.7.0 -llvmlite==0.41.1 -lsprotocol==2023.0.1 -markdown==3.7 -markdown-it-py==2.2.0 -markupsafe==2.1.5 -matplotlib==3.7.5 -matplotlib-inline==0.1.7 -mdit-py-plugins==0.3.5 -mdurl==0.1.2 -mistune==3.0.2 -ml-dtypes==0.2.0 -mpmath==1.3.0 -mypy==1.11.2 -mypy-extensions==1.0.0 -myst-nb==0.17.2 -myst-parser==0.18.1 -nbclient==0.6.8 -nbconvert==7.16.4 -nbdime==4.0.2 -nbformat==5.10.4 -nbmake==1.5.4 -nest-asyncio==1.6.0 -nodeenv==1.9.1 -notebook==7.2.2 -notebook-shim==0.2.4 -numba==0.58.1 -numpy==1.24.4 -oauthlib==3.2.2 -opt-einsum==3.3.0 -overrides==7.7.0 -packaging==24.1 -pandas==2.0.3 -pandocfilters==1.5.1 -parso==0.8.4 -particle==0.25.0 -pexpect==4.9.0 -phasespace==1.9.0 -pickleshare==0.7.5 -pillow==10.4.0 -pkgutil-resolve-name==1.3.10 -platformdirs==4.3.2 -pluggy==1.5.0 -pre-commit==3.5.0 -prometheus-client==0.20.0 -prompt-toolkit==3.0.47 -protobuf==3.19.6 -psutil==6.0.0 -ptyprocess==0.7.0 -pure-eval==0.2.3 -py-cpuinfo==9.0.0 -pyarrow==17.0.0 -pyasn1==0.6.1 -pyasn1-modules==0.4.1 -pycparser==2.22 -pydata-sphinx-theme==0.14.4 -pygments==2.18.0 -pyparsing==3.1.4 -pyproject-api==1.7.1 -pytest==8.3.3 -pytest-benchmark==4.0.0 -pytest-cov==5.0.0 -pytest-mock==3.14.0 -pytest-xdist==3.6.1 -python-constraint2==2.0.0b5 -python-dateutil==2.9.0.post0 -python-json-logger==2.0.7 -python-lsp-jsonrpc==1.1.2 -python-lsp-ruff==2.2.2 -python-lsp-server==1.12.0 -pytoolconfig==1.3.1 -pytz==2024.1 -pyyaml==6.0.2 -pyzmq==26.2.0 -qrules==0.10.2 -referencing==0.35.1 -requests==2.32.3 -requests-oauthlib==2.0.0 -rfc3339-validator==0.1.4 -rfc3986-validator==0.1.1 -rope==1.13.0 -rpds-py==0.20.0 -rsa==4.9 -ruff==0.6.4 -scipy==1.10.1 -send2trash==1.8.3 -six==1.16.0 -smmap==5.0.1 -sniffio==1.3.1 -snowballstemmer==2.2.0 -soupsieve==2.6 -sphinx==5.3.0 -sphinx-api-relink==0.0.9 -sphinx-autobuild==2021.3.14 -sphinx-book-theme==1.0.1 -sphinx-codeautolink==0.15.2 -sphinx-comments==0.0.3 -sphinx-copybutton==0.5.2 -sphinx-design==0.5.0 -sphinx-thebe==0.3.1 -sphinx-togglebutton==0.3.2 -sphinxcontrib-applehelp==1.0.4 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==2.0.1 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.5 -sphobjinv==2.3.1.1 -sqlalchemy==2.0.34 -stack-data==0.6.3 -sympy==1.13.2 -tabulate==0.9.0 -tensorboard==2.11.2 -tensorboard-data-server==0.6.1 -tensorboard-plugin-wit==1.8.1 -tensorflow==2.11.1 -tensorflow-estimator==2.11.0 -tensorflow-io-gcs-filesystem==0.34.0 -tensorflow-probability==0.20.1 -termcolor==2.4.0 -terminado==0.18.1 -tinycss2==1.3.0 -tomli==2.0.1 -tornado==6.4.1 -tox==4.18.1 -tqdm==4.66.5 -traitlets==5.14.3 -types-protobuf==5.27.0.20240907 -types-python-dateutil==2.9.0.20240906 -types-pyyaml==6.0.12.20240808 -types-requests==2.32.0.20240907 -types-tensorflow==2.17.0.20240820 -types-tqdm==4.66.0.20240417 -typing-extensions==4.12.2 -tzdata==2024.1 -ujson==5.10.0 -uri-template==1.3.0 -urllib3==2.2.2 -virtualenv==20.26.4 -wcwidth==0.2.13 -webcolors==24.8.0 -webencodings==0.5.1 -websocket-client==1.8.0 -werkzeug==3.0.4 -wheel==0.44.0 -widgetsnbextension==4.0.13 -wrapt==1.16.0 -zipp==3.20.1 - -# The following packages were excluded from the output: -# setuptools diff --git a/benchmarks/ampform.py b/benchmarks/ampform.py index 22cdbafe..f874fee2 100644 --- a/benchmarks/ampform.py +++ b/benchmarks/ampform.py @@ -1,7 +1,7 @@ from __future__ import annotations from pprint import pprint -from typing import TYPE_CHECKING, Mapping, Sequence +from typing import TYPE_CHECKING import numpy as np import pytest @@ -17,6 +17,8 @@ from tensorwaves.function.sympy import create_parametrized_function if TYPE_CHECKING: + from collections.abc import Mapping, Sequence + from ampform.helicity import HelicityModel from qrules.combinatorics import StateDefinition diff --git a/docs/amplitude-analysis.ipynb b/docs/amplitude-analysis.ipynb index cfd701d5..7985eca3 100644 --- a/docs/amplitude-analysis.ipynb +++ b/docs/amplitude-analysis.ipynb @@ -345,7 +345,7 @@ "source": [ "::::{margin}\n", ":::{tip}\n", - "{doc}`TR-018` explains some of the mechanisms behind the phase space generator as well as how to do {ref}`importance sampling`.\n", + "{doc}`TR-018` explains some of the mechanisms behind the phase space generator as well as how to do {ref}`importance sampling`.\n", ":::\n", "::::\n", "\n", diff --git a/docs/conf.py b/docs/conf.py index 8f8a86ba..7e5959c3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -200,6 +200,7 @@ def get_tensorflow_url() -> str: intersphinx_mapping = { "ampform": (f"https://ampform.readthedocs.io/{pin('ampform')}", None), "compwa": ("https://compwa.github.io", None), + "compwa-report": ("https://compwa.github.io/report", None), "graphviz": ("https://graphviz.readthedocs.io/en/stable", None), "iminuit": ("https://scikit-hep.org/iminuit", None), "jax": ("https://jax.readthedocs.io/en/latest", None), diff --git a/pyproject.toml b/pyproject.toml index 7160ffb2..66fb0043 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python", "Topic :: Scientific/Engineering :: Physics", @@ -47,7 +46,7 @@ keywords = [ license = {file = "LICENSE"} maintainers = [{email = "compwa-admin@ep1.rub.de"}] name = "tensorwaves" -requires-python = ">=3.8" +requires-python = ">=3.9" [project.optional-dependencies] all = [ @@ -144,7 +143,6 @@ tf = [ "numpy<2", "tensorflow !=2.15.0.post1", # https://github.com/ComPWA/tensorwaves/actions/runs/7147814088/job/19467965144?pr=509 "tensorflow >=2.4", # tensorflow.experimental.numpy - 'tensorflow <2.12; python_version <"3.9.0"', ] types = [ "sphinx-api-relink >=0.0.4", diff --git a/src/tensorwaves/data/_attrs.py b/src/tensorwaves/data/_attrs.py index f2f0d0f5..d1e638ca 100644 --- a/src/tensorwaves/data/_attrs.py +++ b/src/tensorwaves/data/_attrs.py @@ -1,8 +1,10 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Iterable +from typing import TYPE_CHECKING if TYPE_CHECKING: + from collections.abc import Iterable + from tensorwaves.interface import DataTransformer diff --git a/src/tensorwaves/data/phasespace.py b/src/tensorwaves/data/phasespace.py index f72fd9a0..913e7d3b 100644 --- a/src/tensorwaves/data/phasespace.py +++ b/src/tensorwaves/data/phasespace.py @@ -3,7 +3,7 @@ from __future__ import annotations import logging -from typing import TYPE_CHECKING, Mapping +from typing import TYPE_CHECKING from tqdm.auto import tqdm @@ -19,6 +19,8 @@ from .rng import TFUniformRealNumberGenerator if TYPE_CHECKING: + from collections.abc import Mapping + import numpy as np import tensorflow as tf diff --git a/src/tensorwaves/data/transform.py b/src/tensorwaves/data/transform.py index 42493d50..6b2a3b55 100644 --- a/src/tensorwaves/data/transform.py +++ b/src/tensorwaves/data/transform.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Mapping +from typing import TYPE_CHECKING from attrs import field, frozen @@ -16,6 +16,8 @@ from ._attrs import to_tuple if TYPE_CHECKING: # pragma: no cover + from collections.abc import Mapping + import numpy as np import sympy as sp diff --git a/src/tensorwaves/estimator.py b/src/tensorwaves/estimator.py index 51af0ca1..c0a713e0 100644 --- a/src/tensorwaves/estimator.py +++ b/src/tensorwaves/estimator.py @@ -5,7 +5,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Callable, Iterable, Mapping +from typing import TYPE_CHECKING, Callable from tensorwaves.data.transform import SympyDataTransformer from tensorwaves.function._backend import find_function, raise_missing_module_error @@ -19,6 +19,8 @@ ) if TYPE_CHECKING: + from collections.abc import Iterable, Mapping + import numpy as np import sympy as sp diff --git a/src/tensorwaves/function/__init__.py b/src/tensorwaves/function/__init__.py index 8453c7b5..dfd7c450 100644 --- a/src/tensorwaves/function/__init__.py +++ b/src/tensorwaves/function/__init__.py @@ -3,7 +3,7 @@ from __future__ import annotations import inspect -from typing import Callable, Iterable, Mapping +from typing import TYPE_CHECKING, Callable import attrs import numpy as np @@ -16,6 +16,9 @@ ParametrizedFunction, ) +if TYPE_CHECKING: + from collections.abc import Iterable, Mapping + def _all_str( _: PositionalArgumentFunction, __: attrs.Attribute, value: Iterable[str] diff --git a/src/tensorwaves/function/sympy/__init__.py b/src/tensorwaves/function/sympy/__init__.py index 8e706d31..64097dad 100644 --- a/src/tensorwaves/function/sympy/__init__.py +++ b/src/tensorwaves/function/sympy/__init__.py @@ -3,7 +3,7 @@ from __future__ import annotations import logging -from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, Mapping, Sequence +from typing import TYPE_CHECKING, Any, Callable from tqdm.auto import tqdm @@ -15,6 +15,8 @@ ) if TYPE_CHECKING: # pragma: no cover + from collections.abc import Generator, Iterable, Mapping, Sequence + import sympy as sp from sympy.printing.printer import Printer @@ -42,7 +44,7 @@ def create_function( function faster and speeds up lambdification. max_complexity: See :ref:`usage/faster-lambdify:Specifying complexity` and - :doc:`compwa:report/002`. + :doc:`compwa-report:002`. Example: >>> import numpy as np diff --git a/src/tensorwaves/function/sympy/_printer.py b/src/tensorwaves/function/sympy/_printer.py index 8963c1c6..ff616886 100644 --- a/src/tensorwaves/function/sympy/_printer.py +++ b/src/tensorwaves/function/sympy/_printer.py @@ -1,11 +1,13 @@ from __future__ import annotations import re -from typing import TYPE_CHECKING, Any, Callable, Iterable, TypeVar +from typing import TYPE_CHECKING, Any, Callable, TypeVar from sympy.printing.numpy import NumPyPrinter if TYPE_CHECKING: # pragma: no cover + from collections.abc import Iterable + import sympy as sp diff --git a/src/tensorwaves/interface.py b/src/tensorwaves/interface.py index 4732de58..c986fc71 100644 --- a/src/tensorwaves/interface.py +++ b/src/tensorwaves/interface.py @@ -3,7 +3,8 @@ from __future__ import annotations from abc import ABC, abstractmethod -from typing import TYPE_CHECKING, Any, Dict, Generic, Mapping, TypeVar, Union +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, Generic, TypeVar, Union import attrs import numpy as np @@ -35,7 +36,7 @@ class Function(ABC, Generic[InputType, OutputType]): def __call__(self, data: InputType) -> OutputType: ... -DataSample = Dict[str, np.ndarray] +DataSample = dict[str, np.ndarray] """Mapping of variable names to a sequence of data points, used by `Function`.""" ParameterValue = Union[complex, float] """Allowed types for parameter values.""" diff --git a/src/tensorwaves/optimizer/_parameter.py b/src/tensorwaves/optimizer/_parameter.py index ca063bab..5468fa11 100644 --- a/src/tensorwaves/optimizer/_parameter.py +++ b/src/tensorwaves/optimizer/_parameter.py @@ -1,8 +1,10 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Mapping +from typing import TYPE_CHECKING if TYPE_CHECKING: + from collections.abc import Mapping + from tensorwaves.interface import ParameterValue diff --git a/src/tensorwaves/optimizer/callbacks.py b/src/tensorwaves/optimizer/callbacks.py index 34b93c90..4e8cc92e 100644 --- a/src/tensorwaves/optimizer/callbacks.py +++ b/src/tensorwaves/optimizer/callbacks.py @@ -5,7 +5,7 @@ import csv from abc import ABC, abstractmethod from datetime import datetime -from typing import IO, TYPE_CHECKING, Any, Iterable +from typing import IO, TYPE_CHECKING, Any import numpy as np import yaml @@ -13,6 +13,7 @@ from tensorwaves.function._backend import raise_missing_module_error if TYPE_CHECKING: + from collections.abc import Iterable from pathlib import Path from tensorwaves.interface import Estimator, Optimizer, ParameterValue diff --git a/src/tensorwaves/optimizer/minuit.py b/src/tensorwaves/optimizer/minuit.py index bde546ae..ad9ffacc 100644 --- a/src/tensorwaves/optimizer/minuit.py +++ b/src/tensorwaves/optimizer/minuit.py @@ -5,7 +5,7 @@ import logging import time -from typing import Any, Callable, Iterable, Mapping +from typing import TYPE_CHECKING, Any, Callable import iminuit from tqdm.auto import tqdm @@ -15,6 +15,9 @@ from ._parameter import ParameterFlattener from .callbacks import Callback, _create_log # pyright: ignore[reportPrivateUsage] +if TYPE_CHECKING: + from collections.abc import Iterable, Mapping + _LOGGER = logging.getLogger(__name__) diff --git a/src/tensorwaves/optimizer/scipy.py b/src/tensorwaves/optimizer/scipy.py index 76c28ecd..33637547 100644 --- a/src/tensorwaves/optimizer/scipy.py +++ b/src/tensorwaves/optimizer/scipy.py @@ -5,7 +5,7 @@ import logging import time -from typing import Any, Iterable, Mapping +from typing import TYPE_CHECKING, Any from tqdm.auto import tqdm @@ -15,6 +15,9 @@ from ._parameter import ParameterFlattener from .callbacks import Callback, _create_log # pyright: ignore[reportPrivateUsage] +if TYPE_CHECKING: + from collections.abc import Iterable, Mapping + _LOGGER = logging.getLogger(__name__) diff --git a/tests/data/test_phasespace.py b/tests/data/test_phasespace.py index 634deead..6d2bf2b3 100644 --- a/tests/data/test_phasespace.py +++ b/tests/data/test_phasespace.py @@ -1,5 +1,6 @@ +from collections.abc import Sequence from pprint import pprint -from typing import TYPE_CHECKING, Sequence +from typing import TYPE_CHECKING import numpy as np import pytest diff --git a/tests/optimizer/test_gradient.py b/tests/optimizer/test_gradient.py index 4ffff757..9576de45 100644 --- a/tests/optimizer/test_gradient.py +++ b/tests/optimizer/test_gradient.py @@ -1,7 +1,7 @@ from __future__ import annotations from itertools import product -from typing import TYPE_CHECKING, Mapping +from typing import TYPE_CHECKING import numpy as np import pytest @@ -9,6 +9,8 @@ from tensorwaves.estimator import gradient_creator if TYPE_CHECKING: + from collections.abc import Mapping + from tensorwaves.interface import ParameterValue diff --git a/tests/optimizer/test_minuit.py b/tests/optimizer/test_minuit.py index 980b97d9..cd3da62b 100644 --- a/tests/optimizer/test_minuit.py +++ b/tests/optimizer/test_minuit.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Callable, Mapping +from typing import TYPE_CHECKING, Callable import pytest @@ -10,6 +10,8 @@ from . import CallbackMock, assert_invocations if TYPE_CHECKING: + from collections.abc import Mapping + from pytest_mock import MockerFixture diff --git a/tests/optimizer/test_scipy.py b/tests/optimizer/test_scipy.py index c7116b86..0921811c 100644 --- a/tests/optimizer/test_scipy.py +++ b/tests/optimizer/test_scipy.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Callable, Mapping +from typing import TYPE_CHECKING, Callable import pytest @@ -10,6 +10,8 @@ from . import CallbackMock, assert_invocations if TYPE_CHECKING: + from collections.abc import Mapping + from pytest_mock import MockerFixture