From 7daa6ac5b799b97cbdee3e6f62f6f3a9de061fcd Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 8 Nov 2023 22:44:59 +0100 Subject: [PATCH] BREAK: drop Python 3.7 support --- .constraints/py3.7.txt | 236 ------------------------------------ .pre-commit-config.yaml | 4 +- docs/conf.py | 11 +- pyproject.toml | 14 +-- src/ampform_dpd/__init__.py | 10 +- src/ampform_dpd/decay.py | 8 +- 6 files changed, 12 insertions(+), 271 deletions(-) delete mode 100644 .constraints/py3.7.txt diff --git a/.constraints/py3.7.txt b/.constraints/py3.7.txt deleted file mode 100644 index 89b5c780..00000000 --- a/.constraints/py3.7.txt +++ /dev/null @@ -1,236 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.7 -# by the following command: -# -# pip-compile --extra=dev --no-annotate --output-file=.constraints/py3.7.txt --resolver=backtracking --strip-extras --unsafe-package=ampform-dpd --unsafe-package=pip --unsafe-package=setuptools -# -absl-py==2.0.0 -accessible-pygments==0.0.4 -aiofiles==22.1.0 -aiosqlite==0.19.0 -alabaster==0.7.13 -ampform==0.14.6 -anyio==3.7.1 -argon2-cffi==23.1.0 -argon2-cffi-bindings==21.2.0 -arrow==1.2.3 -astunparse==1.6.3 -attrs==23.1.0 -babel==2.13.0 -backcall==0.2.0 -beautifulsoup4==4.12.2 -black==23.3.0 -bleach==6.0.0 -cached-property==1.5.2 -cachetools==5.3.1 -certifi==2023.7.22 -cffi==1.15.1 -cfgv==3.3.1 -chardet==5.2.0 -charset-normalizer==3.3.0 -click==8.1.7 -cloudpickle==2.2.1 -colorama==0.4.6 -comm==0.1.4 -coverage==7.2.7 -cycler==0.11.0 -debugpy==1.7.0 -decorator==5.1.1 -defusedxml==0.7.1 -deprecated==1.2.14 -distlib==0.3.7 -dm-tree==0.1.8 -docstring-to-markdown==0.12 -docutils==0.17.1 -entrypoints==0.4 -exceptiongroup==1.1.3 -execnet==2.0.2 -fastjsonschema==2.18.1 -filelock==3.12.2 -flatbuffers==23.5.26 -fonttools==4.38.0 -fqdn==1.5.1 -gast==0.4.0 -google-auth==2.23.2 -google-auth-oauthlib==0.4.6 -google-pasta==0.2.0 -graphviz==0.20.1 -greenlet==3.0.0 -grpcio==1.59.0 -h5py==3.8.0 -hepunits==2.3.2 -identify==2.5.24 -idna==3.4 -imagesize==1.4.1 -iminuit==2.18.0 -importlib-metadata==6.7.0 -importlib-resources==5.12.0 -iniconfig==2.0.0 -ipykernel==6.16.2 -ipympl==0.9.3 -ipython==7.34.0 -ipython-genutils==0.2.0 -ipywidgets==8.1.1 -isoduration==20.11.0 -jax==0.3.25 -jaxlib==0.3.25 -jedi==0.18.2 -jinja2==3.1.2 -json5==0.9.14 -jsonpointer==2.4 -jsonschema==4.17.3 -jupyter-cache==0.5.0 -jupyter-client==7.4.9 -jupyter-core==4.12.0 -jupyter-events==0.6.3 -jupyter-lsp==1.5.1 -jupyter-server==1.24.0 -jupyter-server-fileid==0.9.0 -jupyter-server-ydoc==0.8.0 -jupyter-ydoc==0.2.4 -jupyterlab==3.6.6 -jupyterlab-code-formatter==2.2.1 -jupyterlab-lsp==3.10.2 -jupyterlab-myst==1.2.0 -jupyterlab-pygments==0.2.2 -jupyterlab-server==2.24.0 -jupyterlab-widgets==3.0.9 -keras==2.11.0 -kiwisolver==1.4.5 -latexcodec==2.0.1 -libclang==16.0.6 -livereload==2.6.3 -markdown==3.4.4 -markdown-it-py==2.2.0 -markupsafe==2.1.3 -matplotlib==3.5.3 -matplotlib-inline==0.1.6 -mdit-py-plugins==0.3.5 -mdurl==0.1.2 -mistune==3.0.2 -mpmath==1.3.0 -mypy-extensions==1.0.0 -myst-nb==0.17.2 -myst-parser==0.18.1 -nbclassic==1.0.0 -nbclient==0.5.13 -nbconvert==7.6.0 -nbformat==5.8.0 -nbmake==1.2.1 -nest-asyncio==1.5.8 -nodeenv==1.8.0 -notebook==6.5.6 -notebook-shim==0.2.3 -numpy==1.21.6 -oauthlib==3.2.2 -opt-einsum==3.3.0 -packaging==23.2 -pandocfilters==1.5.0 -parso==0.8.3 -particle==0.23.0 -pathspec==0.11.2 -pexpect==4.8.0 -phasespace==1.9.0 -pickleshare==0.7.5 -pillow==9.5.0 -pkgutil-resolve-name==1.3.10 -platformdirs==3.11.0 -pluggy==1.2.0 -pre-commit==2.21.0 -prometheus-client==0.17.1 -prompt-toolkit==3.0.39 -protobuf==3.19.6 -psutil==5.9.5 -ptyprocess==0.7.0 -pyasn1==0.5.0 -pyasn1-modules==0.3.0 -pybtex==0.24.0 -pybtex-docutils==1.0.3 -pycparser==2.21 -pydantic==1.10.13 -pydata-sphinx-theme==0.13.3 -pygments==2.16.1 -pyparsing==3.1.1 -pyproject-api==1.5.3 -pyrsistent==0.19.3 -pytest==7.4.2 -pytest-cov==4.1.0 -pytest-xdist==3.3.1 -python-constraint==1.4.0 -python-dateutil==2.8.2 -python-json-logger==2.0.7 -python-lsp-jsonrpc==1.0.0 -python-lsp-server==1.7.4 -pytoolconfig==1.2.5 -pytz==2023.3.post1 -pyyaml==6.0.1 -pyzmq==24.0.1 -qrules==0.9.8 -requests==2.31.0 -requests-oauthlib==1.3.1 -rfc3339-validator==0.1.4 -rfc3986-validator==0.1.1 -rope==1.9.0 -rsa==4.9 -ruff==0.0.292 -scipy==1.7.3 -send2trash==1.8.2 -singledispatchmethod==1.0 -six==1.16.0 -sniffio==1.3.0 -snowballstemmer==2.2.0 -soupsieve==2.4.1 -sphinx==5.3.0 -sphinx-autobuild==2021.3.14 -sphinx-book-theme==1.0.1 -sphinx-codeautolink==0.15.0 -sphinx-copybutton==0.5.2 -sphinx-design==0.4.1 -sphinx-togglebutton==0.3.2 -sphinxcontrib-applehelp==1.0.2 -sphinxcontrib-bibtex==2.6.1 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==2.0.0 -sphinxcontrib-jsmath==1.0.1 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==1.4.49 -sympy==1.10.1 -tabulate==0.9.0 -tensorboard==2.11.2 -tensorboard-data-server==0.6.1 -tensorboard-plugin-wit==1.8.1 -tensorflow==2.11.0 -tensorflow-estimator==2.11.0 -tensorflow-io-gcs-filesystem==0.34.0 -tensorflow-probability==0.19.0 -tensorwaves==0.4.10 -termcolor==2.3.0 -terminado==0.17.1 -tinycss2==1.2.1 -tomli==2.0.1 -tornado==6.2 -tox==4.8.0 -tqdm==4.66.1 -traitlets==5.9.0 -typed-ast==1.5.5 -typing-extensions==4.7.1 ; python_version < "3.8.0" -ujson==5.7.0 -uri-template==1.3.0 -urllib3==2.0.6 -virtualenv==20.24.5 -wcwidth==0.2.8 -webcolors==1.13 -webencodings==0.5.1 -websocket-client==1.6.1 -werkzeug==2.2.3 -wheel==0.41.2 -widgetsnbextension==4.0.9 -wrapt==1.15.0 -y-py==0.5.9 -ypy-websocket==0.8.2 -zipp==3.15.0 - -# The following packages are considered to be unsafe in a requirements file: -# ampform-dpd -# setuptools diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c2f20dfd..ed1f648c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,7 +43,7 @@ repos: hooks: - id: nbqa-pyupgrade args: - - --py37-plus + - --py38-plus - id: nbqa-ruff args: - --fix @@ -112,7 +112,7 @@ repos: hooks: - id: pyupgrade args: - - --py37-plus + - --py38-plus - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.0.292 diff --git a/docs/conf.py b/docs/conf.py index 05ec2219..92950fc0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,22 +1,17 @@ from __future__ import annotations +import contextlib import os import shutil import subprocess import sys +from importlib.metadata import PackageNotFoundError +from importlib.metadata import version as get_package_version import requests from pybtex.plugin import register_plugin -if sys.version_info < (3, 8): - from importlib_metadata import PackageNotFoundError - from importlib_metadata import version as get_package_version -else: - from importlib.metadata import PackageNotFoundError - from importlib.metadata import version as get_package_version - sys.path.insert(0, os.path.abspath(".")) -import contextlib from _relink_references import relink_references from _unsrt_et_al import MyStyle diff --git a/pyproject.toml b/pyproject.toml index 948a5cd0..27730912 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python", @@ -31,13 +30,12 @@ dependencies = [ "cloudpickle", "sympy >=1.10", # module sympy.printing.numpy and array expressions with shape kwarg "tensorwaves[jax]", - 'typing-extensions; python_version <"3.8.0"', ] description = "Symbolic expressions for Dalitz-Plot Decomposition" dynamic = ["version"] license = {text = "GPLv3 or later"} name = "ampform-dpd" -requires-python = ">=3.7" +requires-python = ">=3.8" [project.optional-dependencies] dev = [ @@ -62,7 +60,6 @@ doc = [ "sphinxcontrib-bibtex", "tensorwaves[phsp]", "tqdm", - 'importlib-metadata; python_version <"3.8.0"', ] format = [ "black", @@ -77,7 +74,6 @@ jupyter = [ "jupyterlab-lsp", "jupyterlab-myst", "python-lsp-server[rope]", - 'ypy-websocket <0.8.3; python_version <"3.8.0"', ] lint = [ "ruff", @@ -103,7 +99,6 @@ test = [ "pytest >=6.0", # pyproject.toml "pytest-cov", "pytest-xdist", - 'nbmake <1.3; python_version <"3.8.0"', ] tf = [ "tensorwaves[tf]", @@ -152,7 +147,6 @@ preview = true target-version = [ "py310", "py311", - "py37", "py38", "py39", ] @@ -253,7 +247,7 @@ extend-select = [ "YTT", ] ignore = [ - "B028", # missing explicit stacklevel keyword + "B028", "C408", "D101", "D102", @@ -266,7 +260,7 @@ ignore = [ "D416", "E501", "ISC003", - "PLR0913", # sympy class + "PLR0913", "S301", "SIM108", ] @@ -275,7 +269,7 @@ src = [ "src", "tests", ] -target-version = "py37" +target-version = "py38" task-tags = ["cspell"] [tool.ruff.pep8-naming] diff --git a/src/ampform_dpd/__init__.py b/src/ampform_dpd/__init__.py index a373afc1..dc13fe91 100644 --- a/src/ampform_dpd/__init__.py +++ b/src/ampform_dpd/__init__.py @@ -1,9 +1,9 @@ # cspell:ignore msigma from __future__ import annotations -import sys from functools import lru_cache from itertools import product +from typing import Literal, Protocol import sympy as sp from ampform.sympy import PoolSum @@ -13,6 +13,7 @@ from sympy.physics.quantum.spin import CG, WignerD from sympy.physics.quantum.spin import Rotation as Wigner +from ampform_dpd.angles import formulate_scattering_angle, formulate_zeta_angle from ampform_dpd.decay import ( IsobarNode, LSCoupling, @@ -23,13 +24,6 @@ ) from ampform_dpd.spin import create_spin_range -from .angles import formulate_scattering_angle, formulate_zeta_angle - -if sys.version_info < (3, 8): - from typing_extensions import Literal, Protocol -else: - from typing import Literal, Protocol - @frozen class AmplitudeModel: diff --git a/src/ampform_dpd/decay.py b/src/ampform_dpd/decay.py index 93e17e13..417451d2 100644 --- a/src/ampform_dpd/decay.py +++ b/src/ampform_dpd/decay.py @@ -1,8 +1,7 @@ """Data structures that describe a three-body decay.""" from __future__ import annotations -import sys -from typing import TYPE_CHECKING, Dict +from typing import TYPE_CHECKING, Dict, Literal from attrs import field, frozen from attrs.validators import instance_of @@ -12,11 +11,6 @@ if TYPE_CHECKING: import sympy as sp -if sys.version_info < (3, 8): - from typing_extensions import Literal -else: - from typing import Literal - @frozen class Particle: