From 28160f09a1a9d9916af0d08ed02fa39d56062fb7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 08:01:52 +0000 Subject: [PATCH 01/26] MAINT: update pip constraints and pre-commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/ComPWA/repo-maintenance: 0.0.182 → 0.0.184](https://github.com/ComPWA/repo-maintenance/compare/0.0.182...0.0.184) - [github.com/ComPWA/mirrors-pyright: v1.1.315 → v1.1.316](https://github.com/ComPWA/mirrors-pyright/compare/v1.1.315...v1.1.316) - [github.com/asottile/pyupgrade: v3.7.0 → v3.8.0](https://github.com/asottile/pyupgrade/compare/v3.7.0...v3.8.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 21578067..25e734f4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.0.182 + rev: 0.0.184 hooks: - id: check-dev-files args: @@ -106,12 +106,12 @@ repos: - id: prettier - repo: https://github.com/ComPWA/mirrors-pyright - rev: v1.1.315 + rev: v1.1.316 hooks: - id: pyright - repo: https://github.com/asottile/pyupgrade - rev: v3.7.0 + rev: v3.8.0 hooks: - id: pyupgrade args: From 508ac7baca2017678eb8ad53286fb9da8e301dab Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 08:04:13 +0000 Subject: [PATCH 02/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .cspell.json | 3 - .gitpod.yml | 2 + .pre-commit-config.yaml | 18 +++-- .vscode/extensions.json | 9 +++ .vscode/settings.json | 6 +- README.md | 1 + docs/_unsrt_et_al.py | 15 +--- docs/comparison/d2kkk.ipynb | 39 +++------ docs/comparison/jpsi2phipipi.ipynb | 39 +++------ docs/comparison/jpsi2pipipi.ipynb | 39 +++------ docs/jpsi2ksp.ipynb | 25 ++---- docs/lc2pkpi.ipynb | 11 +-- pyproject.toml | 126 ++++++++++++++++++++++++++--- pyrightconfig.json | 30 ------- src/ampform_dpd/__init__.py | 11 +-- src/ampform_dpd/dynamics.py | 8 +- src/ampform_dpd/io.py | 14 ++-- tests/test_angles.py | 8 +- 18 files changed, 211 insertions(+), 193 deletions(-) delete mode 100644 pyrightconfig.json diff --git a/.cspell.json b/.cspell.json index 2e00672a..fd41364f 100644 --- a/.cspell.json +++ b/.cspell.json @@ -22,14 +22,11 @@ "*particle*.*ml", ".constraints/*.txt", ".editorconfig", - ".flake8*", ".gitignore", ".gitpod.*", ".mypy.ini", ".pre-commit-config.yaml", ".prettierignore", - ".pydocstyle*", - ".pylintrc", ".readthedocs.yml", ".vscode/*", ".vscode/.gitignore", diff --git a/.gitpod.yml b/.gitpod.yml index 1c6a7656..1eca252d 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -13,9 +13,11 @@ github: vscode: extensions: + - charliermarsh.ruff - eamodio.gitlens - editorconfig.editorconfig - esbenp.prettier-vscode + - garaioag.garaio-vscode-unwanted-recommendations - github.vscode-github-actions - github.vscode-pull-request-github - ms-python.python diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 25e734f4..e1cc061f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,12 +44,14 @@ repos: - id: nbqa-black additional_dependencies: - black>=22.1.0 - - id: nbqa-flake8 - - id: nbqa-isort - id: nbqa-pyupgrade args: - --py37-plus + - id: nbqa-ruff + args: + - --fix + - repo: https://github.com/psf/black rev: 23.3.0 hooks: @@ -71,11 +73,6 @@ repos: .*\.py )$ - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - - repo: https://github.com/kynan/nbstripout rev: 0.6.1 hooks: @@ -117,6 +114,13 @@ repos: args: - --py37-plus + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "" + hooks: + - id: ruff + args: + - --fix + - repo: https://github.com/ComPWA/mirrors-taplo rev: v0.8.0 hooks: diff --git a/.vscode/extensions.json b/.vscode/extensions.json index e9ae2c93..1d9df646 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,8 +1,10 @@ { "recommendations": [ + "charliermarsh.ruff", "eamodio.gitlens", "editorconfig.editorconfig", "esbenp.prettier-vscode", + "garaioag.garaio-vscode-unwanted-recommendations", "github.vscode-github-actions", "github.vscode-pull-request-github", "ms-python.python", @@ -17,5 +19,12 @@ "tamasfe.even-better-toml", "tyriar.sort-lines", "yzhang.markdown-all-in-one" + ], + "unwantedRecommendations": [ + "bungcip.better-toml", + "ms-python.flake8", + "ms-python.isort", + "ms-python.pylint", + "travisillig.vscode-json-stable-stringify" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 6ed525f6..53f9c876 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -34,15 +34,19 @@ "github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"], "livePreview.defaultPreviewPath": "docs/_build/html", "python.analysis.autoImportCompletions": false, - "python.analysis.diagnosticMode": "workspace", "python.analysis.inlayHints.pytestParameters": true, "python.analysis.typeCheckingMode": "strict", "python.formatting.provider": "black", "python.linting.enabled": true, + "python.linting.flake8Enabled": false, + "python.linting.pydocstyleEnabled": false, + "python.linting.pylintEnabled": false, "python.testing.pytestArgs": ["--color=no"], "python.testing.pytestEnabled": true, "python.testing.unittestEnabled": false, "rewrap.wrappingColumn": 88, + "ruff.enable": true, + "ruff.organizeImports": true, "yaml.schemas": { "https://json.schemastore.org/github-workflow.json": ".github/workflows/requirements.yml" } diff --git a/README.md b/README.md index ebd935fd..015f303d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Symbolic Dalitz-Plot Decomposition +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![GPLv3+ license](https://img.shields.io/badge/License-GPLv3+-blue.svg)](https://www.gnu.org/licenses/gpl-3.0-standalone.html) [![PyPI package](https://badge.fury.io/py/ampform-dpd.svg)](https://pypi.org/project/ampform-dpd) diff --git a/docs/_unsrt_et_al.py b/docs/_unsrt_et_al.py index fe01a836..dfe91ca2 100644 --- a/docs/_unsrt_et_al.py +++ b/docs/_unsrt_et_al.py @@ -1,17 +1,10 @@ from pybtex.database import Entry from pybtex.richtext import Tag, Text from pybtex.style.formatting.unsrt import Style as UnsrtStyle -from pybtex.style.template import _format_list # pyright: ignore[reportPrivateUsage] -from pybtex.style.template import ( - FieldIsMissing, - Node, - field, - href, - join, - node, - sentence, - words, -) +from pybtex.style.template import \ + _format_list # pyright: ignore[reportPrivateUsage] +from pybtex.style.template import (FieldIsMissing, Node, field, href, join, + node, sentence, words) class MyStyle(UnsrtStyle): # type: ignore[reportUntypedBaseClass] diff --git a/docs/comparison/d2kkk.ipynb b/docs/comparison/d2kkk.ipynb index 68b99e15..6aa5414f 100644 --- a/docs/comparison/d2kkk.ipynb +++ b/docs/comparison/d2kkk.ipynb @@ -48,37 +48,22 @@ "from ampform.kinematics import FourMomentumSymbol, InvariantMass\n", "from ampform.sympy import perform_cached_doit\n", "from IPython.display import SVG, Latex, Markdown, clear_output, display\n", - "from ipywidgets import (\n", - " Accordion,\n", - " Checkbox,\n", - " GridBox,\n", - " HBox,\n", - " Layout,\n", - " SelectMultiple,\n", - " Tab,\n", - " ToggleButtons,\n", - " VBox,\n", - " interactive_output,\n", - ")\n", + "from ipywidgets import (Accordion, Checkbox, GridBox, HBox, Layout,\n", + " SelectMultiple, Tab, ToggleButtons, VBox,\n", + " interactive_output)\n", "from qrules.transition import ReactionInfo\n", "from tensorwaves.data.phasespace import TFPhaseSpaceGenerator\n", "from tensorwaves.data.rng import TFUniformRealNumberGenerator\n", "from tensorwaves.data.transform import SympyDataTransformer\n", - "from tensorwaves.interface import DataSample, ParameterValue, ParametrizedFunction\n", - "\n", - "from ampform_dpd import DalitzPlotDecompositionBuilder, simplify_latex_rendering\n", - "from ampform_dpd.decay import (\n", - " IsobarNode,\n", - " Particle,\n", - " ThreeBodyDecay,\n", - " ThreeBodyDecayChain,\n", - ")\n", - "from ampform_dpd.io import (\n", - " as_markdown_table,\n", - " aslatex,\n", - " get_readable_hash,\n", - " perform_cached_lambdify,\n", - ")\n", + "from tensorwaves.interface import (DataSample, ParameterValue,\n", + " ParametrizedFunction)\n", + "\n", + "from ampform_dpd import (DalitzPlotDecompositionBuilder,\n", + " simplify_latex_rendering)\n", + "from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay,\n", + " ThreeBodyDecayChain)\n", + "from ampform_dpd.io import (as_markdown_table, aslatex, get_readable_hash,\n", + " perform_cached_lambdify)\n", "from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n", "\n", "simplify_latex_rendering()\n", diff --git a/docs/comparison/jpsi2phipipi.ipynb b/docs/comparison/jpsi2phipipi.ipynb index a6ded54f..47b25a71 100644 --- a/docs/comparison/jpsi2phipipi.ipynb +++ b/docs/comparison/jpsi2phipipi.ipynb @@ -48,37 +48,22 @@ "from ampform.kinematics import FourMomentumSymbol, InvariantMass\n", "from ampform.sympy import perform_cached_doit\n", "from IPython.display import SVG, Latex, Markdown, clear_output, display\n", - "from ipywidgets import (\n", - " Accordion,\n", - " Checkbox,\n", - " GridBox,\n", - " HBox,\n", - " Layout,\n", - " SelectMultiple,\n", - " Tab,\n", - " ToggleButtons,\n", - " VBox,\n", - " interactive_output,\n", - ")\n", + "from ipywidgets import (Accordion, Checkbox, GridBox, HBox, Layout,\n", + " SelectMultiple, Tab, ToggleButtons, VBox,\n", + " interactive_output)\n", "from qrules.transition import ReactionInfo\n", "from tensorwaves.data.phasespace import TFPhaseSpaceGenerator\n", "from tensorwaves.data.rng import TFUniformRealNumberGenerator\n", "from tensorwaves.data.transform import SympyDataTransformer\n", - "from tensorwaves.interface import DataSample, ParameterValue, ParametrizedFunction\n", - "\n", - "from ampform_dpd import DalitzPlotDecompositionBuilder, simplify_latex_rendering\n", - "from ampform_dpd.decay import (\n", - " IsobarNode,\n", - " Particle,\n", - " ThreeBodyDecay,\n", - " ThreeBodyDecayChain,\n", - ")\n", - "from ampform_dpd.io import (\n", - " as_markdown_table,\n", - " aslatex,\n", - " get_readable_hash,\n", - " perform_cached_lambdify,\n", - ")\n", + "from tensorwaves.interface import (DataSample, ParameterValue,\n", + " ParametrizedFunction)\n", + "\n", + "from ampform_dpd import (DalitzPlotDecompositionBuilder,\n", + " simplify_latex_rendering)\n", + "from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay,\n", + " ThreeBodyDecayChain)\n", + "from ampform_dpd.io import (as_markdown_table, aslatex, get_readable_hash,\n", + " perform_cached_lambdify)\n", "from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n", "\n", "simplify_latex_rendering()\n", diff --git a/docs/comparison/jpsi2pipipi.ipynb b/docs/comparison/jpsi2pipipi.ipynb index ecf90aa4..828893f3 100644 --- a/docs/comparison/jpsi2pipipi.ipynb +++ b/docs/comparison/jpsi2pipipi.ipynb @@ -48,37 +48,22 @@ "from ampform.kinematics import FourMomentumSymbol, InvariantMass\n", "from ampform.sympy import perform_cached_doit\n", "from IPython.display import SVG, Latex, Markdown, clear_output, display\n", - "from ipywidgets import (\n", - " Accordion,\n", - " Checkbox,\n", - " GridBox,\n", - " HBox,\n", - " Layout,\n", - " SelectMultiple,\n", - " Tab,\n", - " ToggleButtons,\n", - " VBox,\n", - " interactive_output,\n", - ")\n", + "from ipywidgets import (Accordion, Checkbox, GridBox, HBox, Layout,\n", + " SelectMultiple, Tab, ToggleButtons, VBox,\n", + " interactive_output)\n", "from qrules.transition import ReactionInfo\n", "from tensorwaves.data.phasespace import TFPhaseSpaceGenerator\n", "from tensorwaves.data.rng import TFUniformRealNumberGenerator\n", "from tensorwaves.data.transform import SympyDataTransformer\n", - "from tensorwaves.interface import DataSample, ParameterValue, ParametrizedFunction\n", - "\n", - "from ampform_dpd import DalitzPlotDecompositionBuilder, simplify_latex_rendering\n", - "from ampform_dpd.decay import (\n", - " IsobarNode,\n", - " Particle,\n", - " ThreeBodyDecay,\n", - " ThreeBodyDecayChain,\n", - ")\n", - "from ampform_dpd.io import (\n", - " as_markdown_table,\n", - " aslatex,\n", - " get_readable_hash,\n", - " perform_cached_lambdify,\n", - ")\n", + "from tensorwaves.interface import (DataSample, ParameterValue,\n", + " ParametrizedFunction)\n", + "\n", + "from ampform_dpd import (DalitzPlotDecompositionBuilder,\n", + " simplify_latex_rendering)\n", + "from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay,\n", + " ThreeBodyDecayChain)\n", + "from ampform_dpd.io import (as_markdown_table, aslatex, get_readable_hash,\n", + " perform_cached_lambdify)\n", "from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n", "\n", "simplify_latex_rendering()\n", diff --git a/docs/jpsi2ksp.ipynb b/docs/jpsi2ksp.ipynb index 3bf110fb..36c0a3ce 100644 --- a/docs/jpsi2ksp.ipynb +++ b/docs/jpsi2ksp.ipynb @@ -37,29 +37,18 @@ "import sympy as sp\n", "from ampform.dynamics import EnergyDependentWidth, formulate_form_factor\n", "from ampform.kinematics.phasespace import compute_third_mandelstam\n", - "from ampform.sympy import (\n", - " UnevaluatedExpression,\n", - " create_expression,\n", - " implement_doit_method,\n", - " make_commutative,\n", - " perform_cached_doit,\n", - ")\n", + "from ampform.sympy import (UnevaluatedExpression, create_expression,\n", + " implement_doit_method, make_commutative,\n", + " perform_cached_doit)\n", "from IPython.display import Latex, Markdown\n", "from tensorwaves.data.transform import SympyDataTransformer\n", "from tensorwaves.interface import DataSample, ParametrizedFunction\n", "from tqdm.auto import tqdm\n", "\n", - "from ampform_dpd import (\n", - " DalitzPlotDecompositionBuilder,\n", - " _get_particle,\n", - " simplify_latex_rendering,\n", - ")\n", - "from ampform_dpd.decay import (\n", - " IsobarNode,\n", - " Particle,\n", - " ThreeBodyDecay,\n", - " ThreeBodyDecayChain,\n", - ")\n", + "from ampform_dpd import (DalitzPlotDecompositionBuilder, _get_particle,\n", + " simplify_latex_rendering)\n", + "from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay,\n", + " ThreeBodyDecayChain)\n", "from ampform_dpd.io import as_markdown_table, aslatex, perform_cached_lambdify\n", "from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n", "\n", diff --git a/docs/lc2pkpi.ipynb b/docs/lc2pkpi.ipynb index c2a3d7da..07d0a60b 100644 --- a/docs/lc2pkpi.ipynb +++ b/docs/lc2pkpi.ipynb @@ -33,13 +33,10 @@ "import sympy as sp\n", "from IPython.display import Latex, Markdown\n", "\n", - "from ampform_dpd import DalitzPlotDecompositionBuilder, simplify_latex_rendering\n", - "from ampform_dpd.decay import (\n", - " IsobarNode,\n", - " Particle,\n", - " ThreeBodyDecay,\n", - " ThreeBodyDecayChain,\n", - ")\n", + "from ampform_dpd import (DalitzPlotDecompositionBuilder,\n", + " simplify_latex_rendering)\n", + "from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay,\n", + " ThreeBodyDecayChain)\n", "from ampform_dpd.dynamics import BreitWignerMinL\n", "from ampform_dpd.io import as_markdown_table, aslatex\n", "from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n", diff --git a/pyproject.toml b/pyproject.toml index 891e8526..f660b677 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,21 +32,20 @@ target-version = [ "py39", ] -[tool.isort] -known_third_party = "THIRDPARTY,sympy" -profile = "black" -src_paths = [ - "src", -] - [tool.nbqa.addopts] black = [ "--line-length=85", ] -flake8 = [ - "--extend-ignore=E501,E731", -] -isort = [ +ruff = [ + "--extend-ignore=B018", + "--extend-ignore=C90", + "--extend-ignore=D", + "--extend-ignore=N806", + "--extend-ignore=N816", + "--extend-ignore=PLR09", + "--extend-ignore=PLR2004", + "--extend-ignore=PLW0602", + "--extend-ignore=PLW0603", "--line-length=85", ] @@ -78,3 +77,108 @@ testpaths = [ "src", "tests", ] + +[tool.pyright] +exclude = [ + "**/.git", + "**/.ipynb_checkpoints", + "**/.mypy_cache", + "**/.pytest_cache", + "**/.tox", + "**/__pycache__", + "**/_build", +] +reportGeneralTypeIssues = false +reportImportCycles = false +reportIncompatibleMethodOverride = false +reportMissingParameterType = false +reportMissingTypeArgument = false +reportMissingTypeStubs = false +reportPrivateImportUsage = false +reportUnknownArgumentType = false +reportUnknownLambdaType = false +reportUnknownMemberType = false +reportUnknownParameterType = false +reportUnknownVariableType = false +reportUnnecessaryContains = false +reportUnnecessaryIsInstance = false +reportUnusedClass = true +reportUnusedFunction = true +reportUnusedImport = true +reportUnusedVariable = true +typeCheckingMode = "strict" + +[tool.ruff] +extend-select = [ + "A", + "B", + "BLE", + "C4", + "C90", + "D", + "EM", + "ERA", + "FA", + "I", + "ICN", + "INP", + "ISC", + "N", + "NPY", + "PGH", + "PIE", + "PL", + "Q", + "RET", + "RSE", + "RUF", + "S", + "SIM", + "T20", + "TCH", + "TID", + "TRY", + "UP", + "YTT", +] +ignore = [ + "D101", + "D102", + "D103", + "D105", + "D107", + "D203", + "D213", + "D407", + "D416", + "E501", + "SIM108", +] +show-fixes = true +target-version = "py37" +task-tags = ["cspell"] +src = [ + "src", + "tests", +] + +[tool.ruff.per-file-ignores] +"docs/*" = [ + "E402", + "INP001", + "S101", + "S113", + "T201", +] +"setup.py" = ["D100"] +"tests/*" = [ + "D", + "INP001", + "PGH001", + "PLR0913", + "PLR2004", + "S101", +] + +[tool.ruff.pydocstyle] +convention = "google" diff --git a/pyrightconfig.json b/pyrightconfig.json deleted file mode 100644 index bb58f27a..00000000 --- a/pyrightconfig.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "exclude": [ - "**/__pycache__", - "**/_build", - "**/.git", - "**/.ipynb_checkpoints", - "**/.mypy_cache", - "**/.pytest_cache", - "**/.tox" - ], - "reportGeneralTypeIssues": false, - "reportImportCycles": false, - "reportIncompatibleMethodOverride": false, - "reportMissingParameterType": false, - "reportMissingTypeArgument": false, - "reportMissingTypeStubs": false, - "reportPrivateImportUsage": false, - "reportUnknownArgumentType": false, - "reportUnknownLambdaType": false, - "reportUnknownMemberType": false, - "reportUnknownParameterType": false, - "reportUnknownVariableType": false, - "reportUnnecessaryContains": false, - "reportUnnecessaryIsInstance": false, - "reportUnusedClass": true, - "reportUnusedFunction": true, - "reportUnusedImport": true, - "reportUnusedVariable": true, - "typeCheckingMode": "strict" -} diff --git a/src/ampform_dpd/__init__.py b/src/ampform_dpd/__init__.py index 33b87f33..46d78ae2 100644 --- a/src/ampform_dpd/__init__.py +++ b/src/ampform_dpd/__init__.py @@ -14,14 +14,9 @@ from sympy.physics.quantum.spin import Rotation as Wigner from sympy.physics.quantum.spin import WignerD -from ampform_dpd.decay import ( - IsobarNode, - LSCoupling, - Particle, - ThreeBodyDecay, - ThreeBodyDecayChain, - get_decay_product_ids, -) +from ampform_dpd.decay import (IsobarNode, LSCoupling, Particle, + ThreeBodyDecay, ThreeBodyDecayChain, + get_decay_product_ids) from ampform_dpd.spin import create_spin_range from .angles import formulate_scattering_angle, formulate_zeta_angle diff --git a/src/ampform_dpd/dynamics.py b/src/ampform_dpd/dynamics.py index a085f6c2..baa9a49f 100644 --- a/src/ampform_dpd/dynamics.py +++ b/src/ampform_dpd/dynamics.py @@ -5,12 +5,8 @@ import sympy as sp from ampform.kinematics.phasespace import Kallen -from ampform.sympy import ( - UnevaluatedExpression, - create_expression, - implement_doit_method, - make_commutative, -) +from ampform.sympy import (UnevaluatedExpression, create_expression, + implement_doit_method, make_commutative) @make_commutative diff --git a/src/ampform_dpd/io.py b/src/ampform_dpd/io.py index 3db25857..88920d6a 100644 --- a/src/ampform_dpd/io.py +++ b/src/ampform_dpd/io.py @@ -31,11 +31,15 @@ import cloudpickle import sympy as sp from ampform.io import aslatex -from tensorwaves.function import ParametrizedBackendFunction, PositionalArgumentFunction -from tensorwaves.function.sympy import create_function, create_parametrized_function -from tensorwaves.interface import Function, ParameterValue, ParametrizedFunction - -from ampform_dpd.decay import IsobarNode, Particle, ThreeBodyDecay, ThreeBodyDecayChain +from tensorwaves.function import (ParametrizedBackendFunction, + PositionalArgumentFunction) +from tensorwaves.function.sympy import (create_function, + create_parametrized_function) +from tensorwaves.interface import (Function, ParameterValue, + ParametrizedFunction) + +from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay, + ThreeBodyDecayChain) _LOGGER = logging.getLogger(__name__) diff --git a/tests/test_angles.py b/tests/test_angles.py index ca8eb2cc..bbc6cc56 100644 --- a/tests/test_angles.py +++ b/tests/test_angles.py @@ -3,11 +3,9 @@ import sympy as sp from ampform.kinematics.phasespace import Kallen, compute_third_mandelstam -from ampform_dpd.angles import ( - formulate_scattering_angle, - formulate_theta_hat_angle, - formulate_zeta_angle, -) +from ampform_dpd.angles import (formulate_scattering_angle, + formulate_theta_hat_angle, + formulate_zeta_angle) m0, m1, m2, m3 = sp.symbols("m:4", nonnegative=True) σ1, σ2, σ3 = sp.symbols("sigma1:4", nonnegative=True) From aa73516d373d1a60455a127a2a33c96d6c9be79a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 08:13:59 +0000 Subject: [PATCH 03/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/_relink_references.py | 6 ++- docs/_unsrt_et_al.py | 15 +++++-- docs/comparison/d2kkk.ipynb | 69 +++++++++++++++++++----------- docs/comparison/jpsi2phipipi.ipynb | 69 +++++++++++++++++++----------- docs/comparison/jpsi2pipipi.ipynb | 69 +++++++++++++++++++----------- docs/conf.py | 11 ++--- docs/jpsi2ksp.ipynb | 34 ++++++++++----- docs/lc2pkpi.ipynb | 14 +++--- src/ampform_dpd/__init__.py | 30 ++++++++----- src/ampform_dpd/_attrs.py | 9 ++-- src/ampform_dpd/angles.py | 25 ++++++----- src/ampform_dpd/decay.py | 41 +++++++++++------- src/ampform_dpd/dynamics.py | 8 +++- src/ampform_dpd/io.py | 40 +++++++++-------- src/ampform_dpd/spin.py | 20 ++++----- tests/test_angles.py | 8 ++-- tests/test_decay.py | 2 +- tests/test_io.py | 8 ++-- 18 files changed, 299 insertions(+), 179 deletions(-) diff --git a/docs/_relink_references.py b/docs/_relink_references.py index 73a591d3..a66c6515 100644 --- a/docs/_relink_references.py +++ b/docs/_relink_references.py @@ -8,11 +8,15 @@ """ from __future__ import annotations +from typing import TYPE_CHECKING + import sphinx.domains.python from docutils import nodes from sphinx.addnodes import pending_xref, pending_xref_condition from sphinx.domains.python import parse_reftarget -from sphinx.environment import BuildEnvironment + +if TYPE_CHECKING: + from sphinx.environment import BuildEnvironment __TARGET_SUBSTITUTIONS = { "Literal[- 1, 1]": "typing.Literal", diff --git a/docs/_unsrt_et_al.py b/docs/_unsrt_et_al.py index dfe91ca2..7d23a167 100644 --- a/docs/_unsrt_et_al.py +++ b/docs/_unsrt_et_al.py @@ -1,10 +1,17 @@ from pybtex.database import Entry from pybtex.richtext import Tag, Text from pybtex.style.formatting.unsrt import Style as UnsrtStyle -from pybtex.style.template import \ - _format_list # pyright: ignore[reportPrivateUsage] -from pybtex.style.template import (FieldIsMissing, Node, field, href, join, - node, sentence, words) +from pybtex.style.template import ( + FieldIsMissing, + Node, + _format_list, # pyright: ignore[reportPrivateUsage] + field, + href, + join, + node, + sentence, + words, +) class MyStyle(UnsrtStyle): # type: ignore[reportUntypedBaseClass] diff --git a/docs/comparison/d2kkk.ipynb b/docs/comparison/d2kkk.ipynb index 6aa5414f..0628f592 100644 --- a/docs/comparison/d2kkk.ipynb +++ b/docs/comparison/d2kkk.ipynb @@ -35,7 +35,7 @@ "import logging\n", "import os\n", "from textwrap import dedent\n", - "from typing import Iterable\n", + "from typing import TYPE_CHECKING, Iterable\n", "\n", "import ampform\n", "import graphviz\n", @@ -44,28 +44,49 @@ "import matplotlib.pyplot as plt\n", "import qrules\n", "import sympy as sp\n", - "from ampform.helicity import HelicityModel\n", "from ampform.kinematics import FourMomentumSymbol, InvariantMass\n", "from ampform.sympy import perform_cached_doit\n", "from IPython.display import SVG, Latex, Markdown, clear_output, display\n", - "from ipywidgets import (Accordion, Checkbox, GridBox, HBox, Layout,\n", - " SelectMultiple, Tab, ToggleButtons, VBox,\n", - " interactive_output)\n", - "from qrules.transition import ReactionInfo\n", + "from ipywidgets import (\n", + " Accordion,\n", + " Checkbox,\n", + " GridBox,\n", + " HBox,\n", + " Layout,\n", + " SelectMultiple,\n", + " Tab,\n", + " ToggleButtons,\n", + " VBox,\n", + " interactive_output,\n", + ")\n", "from tensorwaves.data.phasespace import TFPhaseSpaceGenerator\n", "from tensorwaves.data.rng import TFUniformRealNumberGenerator\n", "from tensorwaves.data.transform import SympyDataTransformer\n", - "from tensorwaves.interface import (DataSample, ParameterValue,\n", - " ParametrizedFunction)\n", - "\n", - "from ampform_dpd import (DalitzPlotDecompositionBuilder,\n", - " simplify_latex_rendering)\n", - "from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay,\n", - " ThreeBodyDecayChain)\n", - "from ampform_dpd.io import (as_markdown_table, aslatex, get_readable_hash,\n", - " perform_cached_lambdify)\n", + "\n", + "from ampform_dpd import DalitzPlotDecompositionBuilder, simplify_latex_rendering\n", + "from ampform_dpd.decay import (\n", + " IsobarNode,\n", + " Particle,\n", + " ThreeBodyDecay,\n", + " ThreeBodyDecayChain,\n", + ")\n", + "from ampform_dpd.io import (\n", + " as_markdown_table,\n", + " aslatex,\n", + " get_readable_hash,\n", + " perform_cached_lambdify,\n", + ")\n", "from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n", "\n", + "if TYPE_CHECKING:\n", + " from ampform.helicity import HelicityModel\n", + " from qrules.transition import ReactionInfo\n", + " from tensorwaves.interface import (\n", + " DataSample,\n", + " ParameterValue,\n", + " ParametrizedFunction,\n", + " )\n", + "\n", "simplify_latex_rendering()\n", "logging.getLogger(\"jax\").setLevel(logging.ERROR) # mute JAX\n", "os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"3\" # mute TF\n", @@ -628,17 +649,16 @@ "outputs": [], "source": [ "def create_sliders() -> dict[str, ToggleButtons]:\n", - " all_parameters = {k: v for k, v in ampform_model.parameter_defaults.items()}\n", - " all_parameters.update({k: v for k, v in dpd_model.parameter_defaults.items()})\n", + " all_parameters = dict(ampform_model.parameter_defaults.items())\n", + " all_parameters.update(dict(dpd_model.parameter_defaults.items()))\n", " sliders = {}\n", " for symbol, value in all_parameters.items():\n", " value = \"+1\"\n", " if (\n", " symbol.name.startswith(R\"\\mathcal{H}^\\mathrm{decay}\")\n", " and \"+\" in symbol.name\n", - " ):\n", - " if any(s in symbol.name for s in [\"{1}\", \"*\", \"rho\"]):\n", - " value = \"-1\"\n", + " ) and any(s in symbol.name for s in [\"{1}\", \"*\", \"rho\"]):\n", + " value = \"-1\"\n", " sliders[symbol.name] = ToggleButtons(\n", " description=Rf\"\\({sp.latex(symbol)}\\)\",\n", " options=[\"-1\", \"0\", \"+1\"],\n", @@ -651,7 +671,7 @@ "def to_unicode(particle: Particle) -> str:\n", " unicode = particle.name\n", " unicode = unicode.replace(\"pi\", \"π\")\n", - " unicode = unicode.replace(\"rho\", \"ρ\")\n", + " unicode = unicode.replace(\"rho\", \"p\")\n", " unicode = unicode.replace(\"Sigma\", \"Σ\")\n", " unicode = unicode.replace(\"~\", \"\")\n", " unicode = unicode.replace(\"Σ\", \"~Σ\")\n", @@ -659,8 +679,7 @@ " unicode = unicode.replace(\"-\", \"⁻\")\n", " unicode = unicode.replace(\"(0)\", \"₀\")\n", " unicode = unicode.replace(\"(1)\", \"₁\")\n", - " unicode = unicode.replace(\")0\", \")⁰\")\n", - " return unicode\n", + " return unicode.replace(\")0\", \")⁰\")\n", "\n", "\n", "sliders = create_sliders()\n", @@ -880,8 +899,8 @@ " )\n", "\n", " global lines\n", - " amp_kwargs = dict(color=\"r\", label=\"ampform\", linestyle=\"solid\")\n", - " dpd_kwargs = dict(color=\"blue\", label=\"dpd\", linestyle=\"dotted\")\n", + " amp_kwargs = {\"color\": \"r\", \"label\": \"ampform\", \"linestyle\": \"solid\"}\n", + " dpd_kwargs = {\"color\": \"blue\", \"label\": \"dpd\", \"linestyle\": \"dotted\"}\n", " if lines is None:\n", " sx = (s_edges[:-1] + s_edges[1:]) / 2\n", " tx = (t_edges[:-1] + t_edges[1:]) / 2\n", diff --git a/docs/comparison/jpsi2phipipi.ipynb b/docs/comparison/jpsi2phipipi.ipynb index 47b25a71..4013353f 100644 --- a/docs/comparison/jpsi2phipipi.ipynb +++ b/docs/comparison/jpsi2phipipi.ipynb @@ -35,7 +35,7 @@ "import logging\n", "import os\n", "from textwrap import dedent\n", - "from typing import Iterable\n", + "from typing import TYPE_CHECKING, Iterable\n", "\n", "import ampform\n", "import graphviz\n", @@ -44,28 +44,49 @@ "import matplotlib.pyplot as plt\n", "import qrules\n", "import sympy as sp\n", - "from ampform.helicity import HelicityModel\n", "from ampform.kinematics import FourMomentumSymbol, InvariantMass\n", "from ampform.sympy import perform_cached_doit\n", "from IPython.display import SVG, Latex, Markdown, clear_output, display\n", - "from ipywidgets import (Accordion, Checkbox, GridBox, HBox, Layout,\n", - " SelectMultiple, Tab, ToggleButtons, VBox,\n", - " interactive_output)\n", - "from qrules.transition import ReactionInfo\n", + "from ipywidgets import (\n", + " Accordion,\n", + " Checkbox,\n", + " GridBox,\n", + " HBox,\n", + " Layout,\n", + " SelectMultiple,\n", + " Tab,\n", + " ToggleButtons,\n", + " VBox,\n", + " interactive_output,\n", + ")\n", "from tensorwaves.data.phasespace import TFPhaseSpaceGenerator\n", "from tensorwaves.data.rng import TFUniformRealNumberGenerator\n", "from tensorwaves.data.transform import SympyDataTransformer\n", - "from tensorwaves.interface import (DataSample, ParameterValue,\n", - " ParametrizedFunction)\n", - "\n", - "from ampform_dpd import (DalitzPlotDecompositionBuilder,\n", - " simplify_latex_rendering)\n", - "from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay,\n", - " ThreeBodyDecayChain)\n", - "from ampform_dpd.io import (as_markdown_table, aslatex, get_readable_hash,\n", - " perform_cached_lambdify)\n", + "\n", + "from ampform_dpd import DalitzPlotDecompositionBuilder, simplify_latex_rendering\n", + "from ampform_dpd.decay import (\n", + " IsobarNode,\n", + " Particle,\n", + " ThreeBodyDecay,\n", + " ThreeBodyDecayChain,\n", + ")\n", + "from ampform_dpd.io import (\n", + " as_markdown_table,\n", + " aslatex,\n", + " get_readable_hash,\n", + " perform_cached_lambdify,\n", + ")\n", "from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n", "\n", + "if TYPE_CHECKING:\n", + " from ampform.helicity import HelicityModel\n", + " from qrules.transition import ReactionInfo\n", + " from tensorwaves.interface import (\n", + " DataSample,\n", + " ParameterValue,\n", + " ParametrizedFunction,\n", + " )\n", + "\n", "simplify_latex_rendering()\n", "logging.getLogger(\"jax\").setLevel(logging.ERROR) # mute JAX\n", "os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"3\" # mute TF\n", @@ -611,17 +632,16 @@ "outputs": [], "source": [ "def create_sliders() -> dict[str, ToggleButtons]:\n", - " all_parameters = {k: v for k, v in ampform_model.parameter_defaults.items()}\n", - " all_parameters.update({k: v for k, v in dpd_model.parameter_defaults.items()})\n", + " all_parameters = dict(ampform_model.parameter_defaults.items())\n", + " all_parameters.update(dict(dpd_model.parameter_defaults.items()))\n", " sliders = {}\n", " for symbol, value in all_parameters.items():\n", " value = \"+1\"\n", " if (\n", " symbol.name.startswith(R\"\\mathcal{H}^\\mathrm{decay}\")\n", " and \"+\" in symbol.name\n", - " ):\n", - " if any(s in symbol.name for s in [\"{1}\", \"*\", \"rho\"]):\n", - " value = \"-1\"\n", + " ) and any(s in symbol.name for s in [\"{1}\", \"*\", \"rho\"]):\n", + " value = \"-1\"\n", " sliders[symbol.name] = ToggleButtons(\n", " description=Rf\"\\({sp.latex(symbol)}\\)\",\n", " options=[\"-1\", \"0\", \"+1\"],\n", @@ -634,7 +654,7 @@ "def to_unicode(particle: Particle) -> str:\n", " unicode = particle.name\n", " unicode = unicode.replace(\"pi\", \"π\")\n", - " unicode = unicode.replace(\"rho\", \"ρ\")\n", + " unicode = unicode.replace(\"rho\", \"p\")\n", " unicode = unicode.replace(\"Sigma\", \"Σ\")\n", " unicode = unicode.replace(\"~\", \"\")\n", " unicode = unicode.replace(\"Σ\", \"~Σ\")\n", @@ -642,8 +662,7 @@ " unicode = unicode.replace(\"-\", \"⁻\")\n", " unicode = unicode.replace(\"(0)\", \"₀\")\n", " unicode = unicode.replace(\"(1)\", \"₁\")\n", - " unicode = unicode.replace(\")0\", \")⁰\")\n", - " return unicode\n", + " return unicode.replace(\")0\", \")⁰\")\n", "\n", "\n", "sliders = create_sliders()\n", @@ -864,8 +883,8 @@ " )\n", "\n", " global lines\n", - " amp_kwargs = dict(color=\"r\", label=\"ampform\", linestyle=\"solid\")\n", - " dpd_kwargs = dict(color=\"blue\", label=\"dpd\", linestyle=\"dotted\")\n", + " amp_kwargs = {\"color\": \"r\", \"label\": \"ampform\", \"linestyle\": \"solid\"}\n", + " dpd_kwargs = {\"color\": \"blue\", \"label\": \"dpd\", \"linestyle\": \"dotted\"}\n", " if lines is None:\n", " sx1 = (s1_edges[:-1] + s1_edges[1:]) / 2\n", " sx23 = (s23_edges[:-1] + s23_edges[1:]) / 2\n", diff --git a/docs/comparison/jpsi2pipipi.ipynb b/docs/comparison/jpsi2pipipi.ipynb index 828893f3..9a15747c 100644 --- a/docs/comparison/jpsi2pipipi.ipynb +++ b/docs/comparison/jpsi2pipipi.ipynb @@ -35,7 +35,7 @@ "import logging\n", "import os\n", "from textwrap import dedent\n", - "from typing import Iterable\n", + "from typing import TYPE_CHECKING, Iterable\n", "\n", "import ampform\n", "import graphviz\n", @@ -44,28 +44,49 @@ "import matplotlib.pyplot as plt\n", "import qrules\n", "import sympy as sp\n", - "from ampform.helicity import HelicityModel\n", "from ampform.kinematics import FourMomentumSymbol, InvariantMass\n", "from ampform.sympy import perform_cached_doit\n", "from IPython.display import SVG, Latex, Markdown, clear_output, display\n", - "from ipywidgets import (Accordion, Checkbox, GridBox, HBox, Layout,\n", - " SelectMultiple, Tab, ToggleButtons, VBox,\n", - " interactive_output)\n", - "from qrules.transition import ReactionInfo\n", + "from ipywidgets import (\n", + " Accordion,\n", + " Checkbox,\n", + " GridBox,\n", + " HBox,\n", + " Layout,\n", + " SelectMultiple,\n", + " Tab,\n", + " ToggleButtons,\n", + " VBox,\n", + " interactive_output,\n", + ")\n", "from tensorwaves.data.phasespace import TFPhaseSpaceGenerator\n", "from tensorwaves.data.rng import TFUniformRealNumberGenerator\n", "from tensorwaves.data.transform import SympyDataTransformer\n", - "from tensorwaves.interface import (DataSample, ParameterValue,\n", - " ParametrizedFunction)\n", - "\n", - "from ampform_dpd import (DalitzPlotDecompositionBuilder,\n", - " simplify_latex_rendering)\n", - "from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay,\n", - " ThreeBodyDecayChain)\n", - "from ampform_dpd.io import (as_markdown_table, aslatex, get_readable_hash,\n", - " perform_cached_lambdify)\n", + "\n", + "from ampform_dpd import DalitzPlotDecompositionBuilder, simplify_latex_rendering\n", + "from ampform_dpd.decay import (\n", + " IsobarNode,\n", + " Particle,\n", + " ThreeBodyDecay,\n", + " ThreeBodyDecayChain,\n", + ")\n", + "from ampform_dpd.io import (\n", + " as_markdown_table,\n", + " aslatex,\n", + " get_readable_hash,\n", + " perform_cached_lambdify,\n", + ")\n", "from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n", "\n", + "if TYPE_CHECKING:\n", + " from ampform.helicity import HelicityModel\n", + " from qrules.transition import ReactionInfo\n", + " from tensorwaves.interface import (\n", + " DataSample,\n", + " ParameterValue,\n", + " ParametrizedFunction,\n", + " )\n", + "\n", "simplify_latex_rendering()\n", "logging.getLogger(\"jax\").setLevel(logging.ERROR) # mute JAX\n", "os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"3\" # mute TF\n", @@ -611,17 +632,16 @@ "outputs": [], "source": [ "def create_sliders() -> dict[str, ToggleButtons]:\n", - " all_parameters = {k: v for k, v in ampform_model.parameter_defaults.items()}\n", - " all_parameters.update({k: v for k, v in dpd_model.parameter_defaults.items()})\n", + " all_parameters = dict(ampform_model.parameter_defaults.items())\n", + " all_parameters.update(dict(dpd_model.parameter_defaults.items()))\n", " sliders = {}\n", " for symbol, value in all_parameters.items():\n", " value = \"+1\"\n", " if (\n", " symbol.name.startswith(R\"\\mathcal{H}^\\mathrm{decay}\")\n", " and \"+\" in symbol.name\n", - " ):\n", - " if any(s in symbol.name for s in [\"{1}\", \"*\", \"rho\"]):\n", - " value = \"-1\"\n", + " ) and any(s in symbol.name for s in [\"{1}\", \"*\", \"rho\"]):\n", + " value = \"-1\"\n", " sliders[symbol.name] = ToggleButtons(\n", " description=Rf\"\\({sp.latex(symbol)}\\)\",\n", " options=[\"-1\", \"0\", \"+1\"],\n", @@ -634,7 +654,7 @@ "def to_unicode(particle: Particle) -> str:\n", " unicode = particle.name\n", " unicode = unicode.replace(\"pi\", \"π\")\n", - " unicode = unicode.replace(\"rho\", \"ρ\")\n", + " unicode = unicode.replace(\"rho\", \"p\")\n", " unicode = unicode.replace(\"Sigma\", \"Σ\")\n", " unicode = unicode.replace(\"~\", \"\")\n", " unicode = unicode.replace(\"Σ\", \"~Σ\")\n", @@ -642,8 +662,7 @@ " unicode = unicode.replace(\"-\", \"⁻\")\n", " unicode = unicode.replace(\"(0)\", \"₀\")\n", " unicode = unicode.replace(\"(1)\", \"₁\")\n", - " unicode = unicode.replace(\")0\", \")⁰\")\n", - " return unicode\n", + " return unicode.replace(\")0\", \")⁰\")\n", "\n", "\n", "sliders = create_sliders()\n", @@ -863,8 +882,8 @@ " )\n", "\n", " global lines\n", - " amp_kwargs = dict(color=\"r\", label=\"ampform\", linestyle=\"solid\")\n", - " dpd_kwargs = dict(color=\"blue\", label=\"dpd\", linestyle=\"dotted\")\n", + " amp_kwargs = {\"color\": \"r\", \"label\": \"ampform\", \"linestyle\": \"solid\"}\n", + " dpd_kwargs = {\"color\": \"blue\", \"label\": \"dpd\", \"linestyle\": \"dotted\"}\n", " if lines is None:\n", " sx = (s_edges[:-1] + s_edges[1:]) / 2\n", " tx = (t_edges[:-1] + t_edges[1:]) / 2\n", diff --git a/docs/conf.py b/docs/conf.py index 71f1c12e..19ba096f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,6 +16,8 @@ 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 @@ -36,13 +38,12 @@ def get_execution_mode() -> str: def get_logo_path() -> str | None: path = "_static/logo.svg" - try: + with contextlib.suppress(requests.exceptions.ConnectionError): _fetch_logo( url="https://raw.githubusercontent.com/ComPWA/ComPWA/04e5199/doc/images/logo.svg", output_path=path, ) - except requests.exceptions.ConnectionError: - pass + if os.path.exists(path): return path return None @@ -69,8 +70,8 @@ def generate_api() -> None: " ".join( [ "sphinx-apidoc", - f"../src/ampform_dpd/", - f"../src/ampform_dpd/version.py", + "../src/ampform_dpd/", + "../src/ampform_dpd/version.py", "-o api/", "--force", "--no-toc", diff --git a/docs/jpsi2ksp.ipynb b/docs/jpsi2ksp.ipynb index 36c0a3ce..2dfa7cba 100644 --- a/docs/jpsi2ksp.ipynb +++ b/docs/jpsi2ksp.ipynb @@ -29,7 +29,7 @@ "import itertools\n", "import logging\n", "import os\n", - "from typing import Iterable\n", + "from typing import TYPE_CHECKING, Iterable\n", "\n", "import jax.numpy as jnp\n", "import matplotlib.pyplot as plt\n", @@ -37,21 +37,34 @@ "import sympy as sp\n", "from ampform.dynamics import EnergyDependentWidth, formulate_form_factor\n", "from ampform.kinematics.phasespace import compute_third_mandelstam\n", - "from ampform.sympy import (UnevaluatedExpression, create_expression,\n", - " implement_doit_method, make_commutative,\n", - " perform_cached_doit)\n", + "from ampform.sympy import (\n", + " UnevaluatedExpression,\n", + " create_expression,\n", + " implement_doit_method,\n", + " make_commutative,\n", + " perform_cached_doit,\n", + ")\n", "from IPython.display import Latex, Markdown\n", "from tensorwaves.data.transform import SympyDataTransformer\n", - "from tensorwaves.interface import DataSample, ParametrizedFunction\n", "from tqdm.auto import tqdm\n", "\n", - "from ampform_dpd import (DalitzPlotDecompositionBuilder, _get_particle,\n", - " simplify_latex_rendering)\n", - "from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay,\n", - " ThreeBodyDecayChain)\n", + "from ampform_dpd import (\n", + " DalitzPlotDecompositionBuilder,\n", + " _get_particle,\n", + " simplify_latex_rendering,\n", + ")\n", + "from ampform_dpd.decay import (\n", + " IsobarNode,\n", + " Particle,\n", + " ThreeBodyDecay,\n", + " ThreeBodyDecayChain,\n", + ")\n", "from ampform_dpd.io import as_markdown_table, aslatex, perform_cached_lambdify\n", "from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n", "\n", + "if TYPE_CHECKING:\n", + " from tensorwaves.interface import DataSample, ParametrizedFunction\n", + "\n", "simplify_latex_rendering()\n", "logging.getLogger(\"absl\").setLevel(logging.ERROR) # mute JAX\n", "NO_TQDM = \"EXECUTE_NB\" in os.environ\n", @@ -459,8 +472,9 @@ " return s2\n", " if decay_masses == {m1, m2}:\n", " return s3\n", + " msg = f\"Cannot find Mandelstam variable for {''.join(decay_masses)}\"\n", " raise NotImplementedError(\n", - " f\"Cannot find Mandelstam variable for {''.join(decay_masses)}\"\n", + " msg\n", " )" ] }, diff --git a/docs/lc2pkpi.ipynb b/docs/lc2pkpi.ipynb index 07d0a60b..a79a3658 100644 --- a/docs/lc2pkpi.ipynb +++ b/docs/lc2pkpi.ipynb @@ -33,10 +33,13 @@ "import sympy as sp\n", "from IPython.display import Latex, Markdown\n", "\n", - "from ampform_dpd import (DalitzPlotDecompositionBuilder,\n", - " simplify_latex_rendering)\n", - "from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay,\n", - " ThreeBodyDecayChain)\n", + "from ampform_dpd import DalitzPlotDecompositionBuilder, simplify_latex_rendering\n", + "from ampform_dpd.decay import (\n", + " IsobarNode,\n", + " Particle,\n", + " ThreeBodyDecay,\n", + " ThreeBodyDecayChain,\n", + ")\n", "from ampform_dpd.dynamics import BreitWignerMinL\n", "from ampform_dpd.io import as_markdown_table, aslatex\n", "from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n", @@ -304,8 +307,9 @@ " return s2\n", " if decay_masses == {m1, m2}:\n", " return s3\n", + " msg = f\"Cannot find Mandelstam variable for {''.join(decay_masses)}\"\n", " raise NotImplementedError(\n", - " f\"Cannot find Mandelstam variable for {''.join(decay_masses)}\"\n", + " msg\n", " )\n", "\n", "\n", diff --git a/src/ampform_dpd/__init__.py b/src/ampform_dpd/__init__.py index 46d78ae2..cbe5b367 100644 --- a/src/ampform_dpd/__init__.py +++ b/src/ampform_dpd/__init__.py @@ -10,13 +10,17 @@ from attrs import field, frozen from sympy.core.symbol import Str from sympy.physics.matrices import msigma -from sympy.physics.quantum.spin import CG +from sympy.physics.quantum.spin import CG, WignerD from sympy.physics.quantum.spin import Rotation as Wigner -from sympy.physics.quantum.spin import WignerD -from ampform_dpd.decay import (IsobarNode, LSCoupling, Particle, - ThreeBodyDecay, ThreeBodyDecayChain, - get_decay_product_ids) +from ampform_dpd.decay import ( + IsobarNode, + LSCoupling, + Particle, + ThreeBodyDecay, + ThreeBodyDecayChain, + get_decay_product_ids, +) from ampform_dpd.spin import create_spin_range from .angles import formulate_scattering_angle, formulate_zeta_angle @@ -67,8 +71,9 @@ def __init__( self.use_decay_helicity_couplings, ) = min_ls else: + msg = f"Cannot configure helicity couplings with a {type(min_ls).__name__}" raise NotImplementedError( - f"Cannot configure helicity couplings with a {type(min_ls).__name__}", + msg, min_ls, ) @@ -304,14 +309,16 @@ def __get_chain(self, identifier) -> ThreeBodyDecayChain: if isinstance(identifier, ThreeBodyDecayChain): chain = identifier if chain not in set(self.__decay.chains): + msg = f"Decay does not have chain with resonance {chain.resonance.name}" raise ValueError( - f"Decay does not have chain with resonance {chain.resonance.name}" + msg ) return chain if isinstance(identifier, str): return self.__decay.find_chain(identifier) + msg = f"Cannot get decay chain for identifier type {type(identifier)}" raise NotImplementedError( - f"Cannot get decay chain for identifier type {type(identifier)}" + msg ) @property @@ -348,8 +355,9 @@ def _formulate_clebsch_gordan_factors( helicities: dict[Particle, sp.Rational | sp.Symbol], ) -> sp.Expr: if isobar.interaction is None: + msg = "Cannot formulate amplitude model in LS-basis if LS-couplings are missing" raise ValueError( - "Cannot formulate amplitude model in LS-basis if LS-couplings are missing" + msg ) # https://github.com/ComPWA/ampform/blob/65b4efa/src/ampform/helicity/__init__.py#L785-L802 # and supplementary material p.1 (https://cds.cern.ch/record/2824328/files) @@ -391,9 +399,9 @@ def formulate_polarimetry( ) -> tuple[PoolSum, PoolSum, PoolSum]: half = sp.Rational(1, 2) if builder.decay.initial_state.spin != half: + msg = f"Can only formulate polarimetry for an initial state with spin 1/2, but got {builder.decay.initial_state.spin}" raise ValueError( - "Can only formulate polarimetry for an initial state with spin 1/2, but" - f" got {builder.decay.initial_state.spin}" + msg ) model = builder.formulate(reference_subsystem) λ0, λ0_prime = sp.symbols(R"lambda \lambda^{\prime}", rational=True) diff --git a/src/ampform_dpd/_attrs.py b/src/ampform_dpd/_attrs.py index 65aa6502..1a88e18d 100644 --- a/src/ampform_dpd/_attrs.py +++ b/src/ampform_dpd/_attrs.py @@ -4,16 +4,18 @@ from typing import TYPE_CHECKING, SupportsFloat import sympy as sp -from attrs import Attribute if TYPE_CHECKING: + from attrs import Attribute + from ampform_dpd.decay import LSCoupling def assert_spin_value(instance, attribute: Attribute, value: sp.Rational) -> None: if value.denominator not in {1, 2}: + msg = f"{attribute.name} value should be integer or half-integer, not {value}" raise ValueError( - f"{attribute.name} value should be integer or half-integer, not {value}" + msg ) @@ -27,7 +29,8 @@ def to_ls(obj: LSCoupling | tuple[int, SupportsFloat] | None) -> LSCoupling: if isinstance(obj, tuple): L, S = obj return LSCoupling(L, S) - raise TypeError(f"Cannot convert {type(obj).__name__} to {LSCoupling.__name__}") + msg = f"Cannot convert {type(obj).__name__} to {LSCoupling.__name__}" + raise TypeError(msg) def to_rational(obj: SupportsFloat) -> sp.Rational: diff --git a/src/ampform_dpd/angles.py b/src/ampform_dpd/angles.py index 1ef059a3..b1e268b9 100644 --- a/src/ampform_dpd/angles.py +++ b/src/ampform_dpd/angles.py @@ -15,17 +15,20 @@ def formulate_scattering_angle( rest frame of the isobar resonance :math:`(ij)`. """ if not {state_id, sibling_id} <= {1, 2, 3}: - raise ValueError(f"Child IDs need to be one of 1, 2, 3") + msg = "Child IDs need to be one of 1, 2, 3" + raise ValueError(msg) # pyright: ignore[reportUnnecessaryContains] if {state_id, sibling_id} in {(2, 1), (3, 2), (1, 3)}: + msg = f"Cannot compute scattering angle θ{state_id}{sibling_id}" raise NotImplementedError( - f"Cannot compute scattering angle θ{state_id}{sibling_id}" + msg ) if state_id == sibling_id: - raise ValueError(f"IDs of the decay products cannot be equal: {state_id}") + msg = f"IDs of the decay products cannot be equal: {state_id}" + raise ValueError(msg) symbol = sp.Symbol(Rf"theta_{state_id}{sibling_id}", real=True) spectator_id = next(iter({1, 2, 3} - {state_id, sibling_id})) - m0 = sp.Symbol(f"m0", nonnegative=True) + m0 = sp.Symbol("m0", nonnegative=True) mi = sp.Symbol(f"m{state_id}", nonnegative=True) mj = sp.Symbol(f"m{sibling_id}", nonnegative=True) mk = sp.Symbol(f"m{spectator_id}", nonnegative=True) @@ -50,15 +53,16 @@ def formulate_theta_hat_angle( r"""Formulate an expression for :math:`\hat\theta_{i(j)}`.""" allowed_ids = {1, 2, 3} if not {isobar_id, aligned_subsystem} <= allowed_ids: + msg = f"Child IDs need to be one of {', '.join(map(str, allowed_ids))}" raise ValueError( - f"Child IDs need to be one of {', '.join(map(str, allowed_ids))}" + msg ) symbol = sp.Symbol(Rf"\hat\theta_{isobar_id}({aligned_subsystem})", real=True) if isobar_id == aligned_subsystem: return symbol, sp.S.Zero if (isobar_id, aligned_subsystem) in {(3, 1), (1, 2), (2, 3)}: remaining_id = next(iter(allowed_ids - {isobar_id, aligned_subsystem})) - m0 = sp.Symbol(f"m0", nonnegative=True) + m0 = sp.Symbol("m0", nonnegative=True) mi = sp.Symbol(f"m{isobar_id}", nonnegative=True) mj = sp.Symbol(f"m{aligned_subsystem}", nonnegative=True) σi = sp.Symbol(f"sigma{isobar_id}", nonnegative=True) @@ -158,7 +162,8 @@ def formulate_zeta_angle( (2, 3, 1), (3, 1, 2), }: - create_symbols = lambda i: sp.symbols(f"m{i} sigma{i}", nonnegative=True) + def create_symbols(i): + return sp.symbols(f"m{i} sigma{i}", nonnegative=True) mi, σi = create_symbols(rotated_state) mj, σj = create_symbols(aligned_subsystem) mk, σk = create_symbols(reference_subsystem) @@ -174,11 +179,9 @@ def formulate_zeta_angle( (1, 3, 1), (2, 1, 2), (3, 2, 3), - # Eq (A8) (1, 1, 2), (2, 2, 3), (3, 3, 1), - # Eq (A11) (1, 3, 2), (2, 1, 3), (3, 2, 1), @@ -187,7 +190,7 @@ def formulate_zeta_angle( rotated_state, reference_subsystem, aligned_subsystem ) return zeta_symbol, -zeta + msg = f"No expression for ζ^{rotated_state}_{aligned_subsystem}({reference_subsystem})" raise NotImplementedError( - "No expression for" - f" ζ^{rotated_state}_{aligned_subsystem}({reference_subsystem})" + msg ) diff --git a/src/ampform_dpd/decay.py b/src/ampform_dpd/decay.py index a26eabd5..095c5e68 100644 --- a/src/ampform_dpd/decay.py +++ b/src/ampform_dpd/decay.py @@ -2,14 +2,16 @@ from __future__ import annotations import sys -from typing import Dict +from typing import TYPE_CHECKING, Dict -import sympy as sp from attrs import field, frozen from attrs.validators import instance_of from ampform_dpd._attrs import assert_spin_value, to_ls, to_rational +if TYPE_CHECKING: + import sympy as sp + if sys.version_info < (3, 8): from typing_extensions import Literal else: @@ -48,16 +50,17 @@ def __attrs_post_init__(self) -> None: expected_final_state = set(self.final_state.values()) for i, chain in enumerate(self.chains): if chain.parent != expected_initial_state: + msg = f"Chain {i} has initial state {chain.parent.name}, but should have {expected_initial_state.name}" raise ValueError( - f"Chain {i} has initial state {chain.parent.name}, but should have" - f" {expected_initial_state.name}" + msg ) final_state = {chain.spectator, *chain.decay_products} if final_state != expected_final_state: - to_str = lambda s: ", ".join(p.name for p in s) + def to_str(s): + return ", ".join(p.name for p in s) + msg = f"Chain {i} has final state {to_str(final_state)}, but should have {to_str(expected_final_state)}" raise ValueError( - f"Chain {i} has final state {to_str(final_state)}, but should have" - f" {to_str(expected_final_state)}" + msg ) @property @@ -72,7 +75,8 @@ def find_chain(self, resonance_name: str) -> ThreeBodyDecayChain: for chain in self.chains: if chain.resonance.name == resonance_name: return chain - raise KeyError(f"No decay chain found for resonance {resonance_name}") + msg = f"No decay chain found for resonance {resonance_name}" + raise KeyError(msg) def get_subsystem(self, subsystem_id: Literal[1, 2, 3]) -> ThreeBodyDecay: child1_id, child2_id = get_decay_product_ids(subsystem_id) @@ -93,7 +97,8 @@ def get_decay_product_ids(spectator_id: Literal[1, 2, 3]) -> tuple[int, int]: return 3, 1 if spectator_id == 3: return 1, 2 - raise ValueError(f"Spectator ID has to be one of 1, 2, 3, not {spectator_id}") + msg = f"Spectator ID has to be one of 1, 2, 3, not {spectator_id}" + raise ValueError(msg) OuterStates = Dict[Literal[0, 1, 2, 3], Particle] @@ -106,17 +111,23 @@ class ThreeBodyDecayChain: def __attrs_post_init__(self) -> None: if not isinstance(self.decay.child1, IsobarNode): - raise TypeError(f"Child 1 has of type {IsobarNode.__name__} (the decay)") + msg = f"Child 1 has of type {IsobarNode.__name__} (the decay)" + raise TypeError(msg) if not isinstance(self.decay.child1.child1, Particle): - raise TypeError(f"Child 1 of child 1 has of type {Particle.__name__}") + msg = f"Child 1 of child 1 has of type {Particle.__name__}" + raise TypeError(msg) if not isinstance(self.decay.child1.child2, Particle): - raise TypeError(f"Child 2 of child 1 has of type {Particle.__name__}") + msg = f"Child 2 of child 1 has of type {Particle.__name__}" + raise TypeError(msg) if not isinstance(self.decay.child2, Particle): - raise TypeError(f"Child 2 has of type {Particle.__name__} (spectator)") + msg = f"Child 2 has of type {Particle.__name__} (spectator)" + raise TypeError(msg) if self.incoming_ls is None: # pyright: ignore[reportUnnecessaryComparison] - raise ValueError(f"LS-coupling for production node required") + msg = "LS-coupling for production node required" + raise ValueError(msg) if self.outgoing_ls is None: # pyright: ignore[reportUnnecessaryComparison] - raise ValueError(f"LS-coupling for decay node required") + msg = "LS-coupling for decay node required" + raise ValueError(msg) @property def parent(self) -> Particle: diff --git a/src/ampform_dpd/dynamics.py b/src/ampform_dpd/dynamics.py index baa9a49f..a085f6c2 100644 --- a/src/ampform_dpd/dynamics.py +++ b/src/ampform_dpd/dynamics.py @@ -5,8 +5,12 @@ import sympy as sp from ampform.kinematics.phasespace import Kallen -from ampform.sympy import (UnevaluatedExpression, create_expression, - implement_doit_method, make_commutative) +from ampform.sympy import ( + UnevaluatedExpression, + create_expression, + implement_doit_method, + make_commutative, +) @make_commutative diff --git a/src/ampform_dpd/io.py b/src/ampform_dpd/io.py index 88920d6a..927e2fde 100644 --- a/src/ampform_dpd/io.py +++ b/src/ampform_dpd/io.py @@ -25,21 +25,22 @@ from functools import lru_cache from os.path import abspath, dirname, expanduser from textwrap import dedent -from typing import Iterable, Mapping, Sequence, overload +from typing import TYPE_CHECKING, Iterable, Mapping, Sequence, overload from warnings import warn import cloudpickle import sympy as sp from ampform.io import aslatex -from tensorwaves.function import (ParametrizedBackendFunction, - PositionalArgumentFunction) -from tensorwaves.function.sympy import (create_function, - create_parametrized_function) -from tensorwaves.interface import (Function, ParameterValue, - ParametrizedFunction) +from tensorwaves.function.sympy import create_function, create_parametrized_function -from ampform_dpd.decay import (IsobarNode, Particle, ThreeBodyDecay, - ThreeBodyDecayChain) +from ampform_dpd.decay import IsobarNode, Particle, ThreeBodyDecay, ThreeBodyDecayChain + +if TYPE_CHECKING: + from tensorwaves.function import ( + ParametrizedBackendFunction, + PositionalArgumentFunction, + ) + from tensorwaves.interface import Function, ParameterValue, ParametrizedFunction _LOGGER = logging.getLogger(__name__) @@ -66,7 +67,8 @@ def _(obj: sp.Basic, **kwargs) -> str: @aslatex.register(abc.Mapping) def _(obj: Mapping, **kwargs) -> str: if len(obj) == 0: - raise ValueError("Need at least one dictionary item") + msg = "Need at least one dictionary item" + raise ValueError(msg) latex = R"\begin{array}{rcl}" + "\n" for lhs, rhs in obj.items(): latex += Rf" {aslatex(lhs, **kwargs)} &=& {aslatex(rhs, **kwargs)} \\" + "\n" @@ -78,7 +80,8 @@ def _(obj: Mapping, **kwargs) -> str: def _(obj: Iterable, **kwargs) -> str: obj = list(obj) if len(obj) == 0: - raise ValueError("Need at least one item to render as LaTeX") + msg = "Need at least one item to render as LaTeX" + raise ValueError(msg) latex = R"\begin{array}{c}" + "\n" for item in obj: item_latex = aslatex(item, **kwargs) @@ -139,8 +142,9 @@ def as_markdown_table(obj: Sequence) -> str: return _as_decay_markdown_table(obj.chains) if item_type is ThreeBodyDecayChain: return _as_decay_markdown_table(obj) + msg = f"Cannot render a sequence with {item_type.__name__} items as a Markdown table" raise NotImplementedError( - f"Cannot render a sequence with {item_type.__name__} items as a Markdown table" + msg ) @@ -148,10 +152,12 @@ def _determine_item_type(obj) -> type: if not isinstance(obj, abc.Sequence): return type(obj) if len(obj) < 1: - raise ValueError(f"Need at least one entry to render a table") + msg = "Need at least one entry to render a table" + raise ValueError(msg) item_type = type(obj[0]) - if not all(map(lambda i: isinstance(i, item_type), obj)): - raise ValueError(f"Not all items are of type {item_type.__name__}") + if not all(isinstance(i, item_type) for i in obj): + msg = f"Not all items are of type {item_type.__name__}" + raise ValueError(msg) return item_type @@ -189,7 +195,7 @@ def _as_decay_markdown_table(decay_chains: Sequence[ThreeBodyDecayChain]) -> str for chain in decay_chains: child1, child2 = map(aslatex, chain.decay_products) row_items = [ - Rf"${chain.resonance.latex} \to" Rf" {child1} {child2}$", + Rf"${chain.resonance.latex} \to {child1} {child2}$", Rf"${aslatex(chain.resonance, only_jp=True)}$", f"{int(1e3 * chain.resonance.mass):,.0f}", f"{int(1e3 * chain.resonance.width):,.0f}", @@ -207,7 +213,7 @@ def _create_markdown_table_header(column_names: list[str]): def _create_markdown_table_row(items: Iterable): - items = map(lambda i: f"{i}", items) + items = (f"{i}" for i in items) return "| " + " | ".join(items) + " |\n" diff --git a/src/ampform_dpd/spin.py b/src/ampform_dpd/spin.py index 5797a0fa..6de5ed41 100644 --- a/src/ampform_dpd/spin.py +++ b/src/ampform_dpd/spin.py @@ -12,9 +12,8 @@ def generate_ls_couplings( child2_spin: SupportsFloat, max_L: int = 3, ) -> list[tuple[int, sp.Rational]]: - r""" - >>> generate_ls_couplings(1.5, 0.5, 0) - [(1, 1/2), (2, 1/2)] + r""">>> generate_ls_couplings(1.5, 0.5, 0) + [(1, 1/2), (2, 1/2)]. """ s1 = float(child1_spin) s2 = float(child2_spin) @@ -35,12 +34,11 @@ def filter_parity_violating_ls( child1_parity: SupportsInt, child2_parity: SupportsInt, ) -> list[tuple[int, sp.Rational]]: - r""" - >>> LS = generate_ls_couplings(0.5, 1.5, 0) # Λc → Λ(1520)π + r""">>> LS = generate_ls_couplings(0.5, 1.5, 0) # Λc → Λ(1520)π >>> LS [(1, 3/2), (2, 3/2)] >>> filter_parity_violating_ls(LS, +1, -1, -1) - [(2, 3/2)] + [(2, 3/2)]. """ η0, η1, η2 = ( int(parent_parity), @@ -51,9 +49,8 @@ def filter_parity_violating_ls( def create_spin_range(spin: SupportsFloat) -> list[sp.Rational]: - """ - >>> create_spin_range(1.5) - [-3/2, -1/2, 1/2, 3/2] + """>>> create_spin_range(1.5) + [-3/2, -1/2, 1/2, 3/2]. """ return create_rational_range(-spin, spin) @@ -61,9 +58,8 @@ def create_spin_range(spin: SupportsFloat) -> list[sp.Rational]: def create_rational_range( __from: SupportsFloat, __to: SupportsFloat ) -> list[sp.Rational]: - """ - >>> create_rational_range(-0.5, +1.5) - [-1/2, 1/2, 3/2] + """>>> create_rational_range(-0.5, +1.5) + [-1/2, 1/2, 3/2]. """ spin_range = arange(float(__from), +float(__to) + 0.5) return list(map(sp.Rational, spin_range)) diff --git a/tests/test_angles.py b/tests/test_angles.py index bbc6cc56..ca8eb2cc 100644 --- a/tests/test_angles.py +++ b/tests/test_angles.py @@ -3,9 +3,11 @@ import sympy as sp from ampform.kinematics.phasespace import Kallen, compute_third_mandelstam -from ampform_dpd.angles import (formulate_scattering_angle, - formulate_theta_hat_angle, - formulate_zeta_angle) +from ampform_dpd.angles import ( + formulate_scattering_angle, + formulate_theta_hat_angle, + formulate_zeta_angle, +) m0, m1, m2, m3 = sp.symbols("m:4", nonnegative=True) σ1, σ2, σ3 = sp.symbols("sigma1:4", nonnegative=True) diff --git a/tests/test_decay.py b/tests/test_decay.py index 68377963..455bb0f0 100644 --- a/tests/test_decay.py +++ b/tests/test_decay.py @@ -1,7 +1,7 @@ from ampform_dpd.decay import IsobarNode, Particle # https://compwa-org--129.org.readthedocs.build/report/018.html#resonances-and-ls-scheme -dummy_args = dict(mass=0, width=0) +dummy_args = {"mass": 0, "width": 0} Λc = Particle("Λc", latex=R"\Lambda_c^+", spin=0.5, parity=+1, **dummy_args) p = Particle("p", latex="p", spin=0.5, parity=+1, **dummy_args) π = Particle("π+", latex=R"\pi^+", spin=0, parity=-1, **dummy_args) diff --git a/tests/test_io.py b/tests/test_io.py index 9e8f7b73..ba832de7 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -18,7 +18,7 @@ THIS_DIR = dirname(abspath(__file__)) # https://compwa-org--129.org.readthedocs.build/report/018.html#resonances-and-ls-scheme -dummy_args = dict(mass=0, width=0) +dummy_args = {"mass": 0, "width": 0} Λc = Particle("Λc", latex=R"\Lambda_c^+", spin=0.5, parity=+1, **dummy_args) p = Particle("p", latex="p", spin=0.5, parity=+1, **dummy_args) π = Particle("π+", latex=R"\pi^+", spin=0, parity=-1, **dummy_args) @@ -53,9 +53,9 @@ def test_aslatex_isobar_node(): @pytest.mark.parametrize( ("assumptions", "expected_hash"), [ - (dict(), "pythonhashseed-0+7459658071388516764"), - (dict(real=True), "pythonhashseed-0+3665410414623666716"), - (dict(rational=True), "pythonhashseed-0-7926839224244779605"), + ({}, "pythonhashseed-0+7459658071388516764"), + ({"real": True}, "pythonhashseed-0+3665410414623666716"), + ({"rational": True}, "pythonhashseed-0-7926839224244779605"), ], ) def test_get_readable_hash(assumptions, expected_hash, caplog: LogCaptureFixture): From f78d70c80bf78d49b49bb26177e936106f5fc602 Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 4 Jul 2023 08:21:18 +0000 Subject: [PATCH 04/26] MAINT: update pip constraints and pre-commit --- .constraints/py3.10.txt | 40 ++++++++++++++++++++-------------------- .constraints/py3.11.txt | 38 +++++++++++++++++++------------------- .constraints/py3.7.txt | 20 ++++++++++---------- .constraints/py3.8.txt | 38 +++++++++++++++++++------------------- .constraints/py3.9.txt | 40 ++++++++++++++++++++-------------------- .pre-commit-config.yaml | 2 +- 6 files changed, 89 insertions(+), 89 deletions(-) diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt index 4af214ee..d0b16229 100644 --- a/.constraints/py3.10.txt +++ b/.constraints/py3.10.txt @@ -43,7 +43,7 @@ deprecated==1.2.14 distlib==0.3.6 dm-tree==0.1.8 docutils==0.19 -exceptiongroup==1.1.1 +exceptiongroup==1.1.2 execnet==1.9.0 executing==1.2.0 fastjsonschema==2.17.1 @@ -52,46 +52,46 @@ flatbuffers==23.5.26 fonttools==4.40.0 fqdn==1.5.1 gast==0.4.0 -google-auth==2.20.0 +google-auth==2.21.0 google-auth-oauthlib==1.0.0 google-pasta==0.2.0 graphviz==0.20.1 greenlet==2.0.2 -grpcio==1.54.2 +grpcio==1.56.0 h5py==3.9.0 hepunits==2.3.2 identify==2.5.24 idna==3.4 imagesize==1.4.1 -iminuit==2.21.3 +iminuit==2.22.0 importlib-metadata==6.7.0 iniconfig==2.0.0 -ipykernel==6.23.2 +ipykernel==6.24.0 ipympl==0.9.3 ipython==8.14.0 ipython-genutils==0.2.0 ipywidgets==8.0.6 isoduration==20.11.0 isort==5.12.0 -jax==0.4.12 -jaxlib==0.4.12 +jax==0.4.13 +jaxlib==0.4.13 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 jsonschema==4.17.3 jupyter-cache==0.6.1 -jupyter-client==8.2.0 +jupyter-client==8.3.0 jupyter-core==5.3.1 jupyter-events==0.6.3 -jupyter-server==2.6.0 +jupyter-server==2.7.0 jupyter-server-fileid==0.9.0 jupyter-server-terminals==0.4.4 jupyter-server-ydoc==0.8.0 jupyter-ydoc==0.2.4 -jupyterlab==3.6.4 +jupyterlab==3.6.5 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==1.2.0 +jupyterlab-myst==2.0.0 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 jupyterlab-widgets==3.0.7 @@ -129,13 +129,13 @@ overrides==7.3.1 packaging==23.1 pandocfilters==1.5.0 parso==0.8.3 -particle==0.22.1 +particle==0.23.0 pathspec==0.11.1 pexpect==4.8.0 phasespace==1.8.0 pickleshare==0.7.5 -pillow==9.5.0 -platformdirs==3.7.0 +pillow==10.0.0 +platformdirs==3.8.0 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 @@ -149,13 +149,13 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.9 +pydantic==1.10.10 pydata-sphinx-theme==0.13.3 pygments==2.15.1 pyparsing==3.1.0 pyproject-api==1.5.2 pyrsistent==0.19.3 -pytest==7.3.2 +pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 python-constraint==1.4.0 @@ -169,7 +169,7 @@ requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rsa==4.9 -scipy==1.10.1 +scipy==1.11.1 send2trash==1.8.2 six==1.16.0 sniffio==1.3.0 @@ -189,7 +189,7 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.16 +sqlalchemy==2.0.17 stack-data==0.6.2 sympy==1.12 tabulate==0.9.0 @@ -208,14 +208,14 @@ tornado==6.3.2 tox==4.6.3 tqdm==4.65.0 traitlets==5.9.0 -typing-extensions==4.6.3 +typing-extensions==4.7.1 uri-template==1.3.0 urllib3==1.26.16 virtualenv==20.23.1 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.0 +websocket-client==1.6.1 werkzeug==2.3.6 wheel==0.40.0 widgetsnbextension==4.0.7 diff --git a/.constraints/py3.11.txt b/.constraints/py3.11.txt index c36e45ca..2fa3fb8d 100644 --- a/.constraints/py3.11.txt +++ b/.constraints/py3.11.txt @@ -51,46 +51,46 @@ flatbuffers==23.5.26 fonttools==4.40.0 fqdn==1.5.1 gast==0.4.0 -google-auth==2.20.0 +google-auth==2.21.0 google-auth-oauthlib==1.0.0 google-pasta==0.2.0 graphviz==0.20.1 greenlet==2.0.2 -grpcio==1.54.2 +grpcio==1.56.0 h5py==3.9.0 hepunits==2.3.2 identify==2.5.24 idna==3.4 imagesize==1.4.1 -iminuit==2.21.3 +iminuit==2.22.0 importlib-metadata==6.7.0 iniconfig==2.0.0 -ipykernel==6.23.2 +ipykernel==6.24.0 ipympl==0.9.3 ipython==8.14.0 ipython-genutils==0.2.0 ipywidgets==8.0.6 isoduration==20.11.0 isort==5.12.0 -jax==0.4.12 -jaxlib==0.4.12 +jax==0.4.13 +jaxlib==0.4.13 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 jsonschema==4.17.3 jupyter-cache==0.6.1 -jupyter-client==8.2.0 +jupyter-client==8.3.0 jupyter-core==5.3.1 jupyter-events==0.6.3 -jupyter-server==2.6.0 +jupyter-server==2.7.0 jupyter-server-fileid==0.9.0 jupyter-server-terminals==0.4.4 jupyter-server-ydoc==0.8.0 jupyter-ydoc==0.2.4 -jupyterlab==3.6.4 +jupyterlab==3.6.5 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==1.2.0 +jupyterlab-myst==2.0.0 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 jupyterlab-widgets==3.0.7 @@ -128,13 +128,13 @@ overrides==7.3.1 packaging==23.1 pandocfilters==1.5.0 parso==0.8.3 -particle==0.22.1 +particle==0.23.0 pathspec==0.11.1 pexpect==4.8.0 phasespace==1.8.0 pickleshare==0.7.5 -pillow==9.5.0 -platformdirs==3.7.0 +pillow==10.0.0 +platformdirs==3.8.0 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 @@ -148,13 +148,13 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.9 +pydantic==1.10.10 pydata-sphinx-theme==0.13.3 pygments==2.15.1 pyparsing==3.1.0 pyproject-api==1.5.2 pyrsistent==0.19.3 -pytest==7.3.2 +pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 python-constraint==1.4.0 @@ -168,7 +168,7 @@ requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rsa==4.9 -scipy==1.10.1 +scipy==1.11.1 send2trash==1.8.2 six==1.16.0 sniffio==1.3.0 @@ -188,7 +188,7 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.16 +sqlalchemy==2.0.17 stack-data==0.6.2 sympy==1.12 tabulate==0.9.0 @@ -206,14 +206,14 @@ tornado==6.3.2 tox==4.6.3 tqdm==4.65.0 traitlets==5.9.0 -typing-extensions==4.6.3 +typing-extensions==4.7.1 uri-template==1.3.0 urllib3==1.26.16 virtualenv==20.23.1 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.0 +websocket-client==1.6.1 werkzeug==2.3.6 wheel==0.40.0 widgetsnbextension==4.0.7 diff --git a/.constraints/py3.7.txt b/.constraints/py3.7.txt index 0840293d..800035c2 100644 --- a/.constraints/py3.7.txt +++ b/.constraints/py3.7.txt @@ -42,7 +42,7 @@ distlib==0.3.6 dm-tree==0.1.8 docutils==0.19 entrypoints==0.4 -exceptiongroup==1.1.1 +exceptiongroup==1.1.2 execnet==1.9.0 fastjsonschema==2.17.1 filelock==3.12.2 @@ -50,12 +50,12 @@ flatbuffers==23.5.26 fonttools==4.38.0 fqdn==1.5.1 gast==0.4.0 -google-auth==2.20.0 +google-auth==2.21.0 google-auth-oauthlib==0.4.6 google-pasta==0.2.0 graphviz==0.20.1 greenlet==2.0.2 -grpcio==1.54.2 +grpcio==1.56.0 h5py==3.8.0 hepunits==2.3.2 identify==2.5.24 @@ -87,7 +87,7 @@ 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.4 +jupyterlab==3.6.5 jupyterlab-code-formatter==2.2.1 jupyterlab-myst==1.2.0 jupyterlab-pygments==0.2.2 @@ -125,14 +125,14 @@ opt-einsum==3.3.0 packaging==23.1 pandocfilters==1.5.0 parso==0.8.3 -particle==0.22.1 +particle==0.23.0 pathspec==0.11.1 pexpect==4.8.0 phasespace==1.8.0 pickleshare==0.7.5 pillow==9.5.0 pkgutil-resolve-name==1.3.10 -platformdirs==3.7.0 +platformdirs==3.8.0 pluggy==1.2.0 pre-commit==2.21.0 prometheus-client==0.17.0 @@ -145,13 +145,13 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.9 +pydantic==1.10.10 pydata-sphinx-theme==0.13.3 pygments==2.15.1 pyparsing==3.1.0 pyproject-api==1.5.2 pyrsistent==0.19.3 -pytest==7.3.2 +pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 python-constraint==1.4.0 @@ -207,14 +207,14 @@ tox==4.6.3 tqdm==4.65.0 traitlets==5.9.0 typed-ast==1.5.4 -typing-extensions==4.6.3 ; python_version < "3.8.0" +typing-extensions==4.7.1 ; python_version < "3.8.0" uri-template==1.3.0 urllib3==1.26.16 virtualenv==20.23.1 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.0 +websocket-client==1.6.1 werkzeug==2.2.3 wheel==0.40.0 widgetsnbextension==4.0.7 diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index e4ff6227..dc890cad 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -43,7 +43,7 @@ deprecated==1.2.14 distlib==0.3.6 dm-tree==0.1.8 docutils==0.19 -exceptiongroup==1.1.1 +exceptiongroup==1.1.2 execnet==1.9.0 executing==1.2.0 fastjsonschema==2.17.1 @@ -52,47 +52,47 @@ flatbuffers==23.5.26 fonttools==4.40.0 fqdn==1.5.1 gast==0.4.0 -google-auth==2.20.0 +google-auth==2.21.0 google-auth-oauthlib==1.0.0 google-pasta==0.2.0 graphviz==0.20.1 greenlet==2.0.2 -grpcio==1.54.2 +grpcio==1.56.0 h5py==3.9.0 hepunits==2.3.2 identify==2.5.24 idna==3.4 imagesize==1.4.1 -iminuit==2.21.3 +iminuit==2.22.0 importlib-metadata==6.7.0 importlib-resources==5.12.0 iniconfig==2.0.0 -ipykernel==6.23.2 +ipykernel==6.24.0 ipympl==0.9.3 ipython==8.12.2 ipython-genutils==0.2.0 ipywidgets==8.0.6 isoduration==20.11.0 isort==5.12.0 -jax==0.4.12 -jaxlib==0.4.12 +jax==0.4.13 +jaxlib==0.4.13 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 jsonschema==4.17.3 jupyter-cache==0.6.1 -jupyter-client==8.2.0 +jupyter-client==8.3.0 jupyter-core==5.3.1 jupyter-events==0.6.3 -jupyter-server==2.6.0 +jupyter-server==2.7.0 jupyter-server-fileid==0.9.0 jupyter-server-terminals==0.4.4 jupyter-server-ydoc==0.8.0 jupyter-ydoc==0.2.4 -jupyterlab==3.6.4 +jupyterlab==3.6.5 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==1.2.0 +jupyterlab-myst==2.0.0 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 jupyterlab-widgets==3.0.7 @@ -130,14 +130,14 @@ overrides==7.3.1 packaging==23.1 pandocfilters==1.5.0 parso==0.8.3 -particle==0.22.1 +particle==0.23.0 pathspec==0.11.1 pexpect==4.8.0 phasespace==1.8.0 pickleshare==0.7.5 -pillow==9.5.0 +pillow==10.0.0 pkgutil-resolve-name==1.3.10 -platformdirs==3.7.0 +platformdirs==3.8.0 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 @@ -151,13 +151,13 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.9 +pydantic==1.10.10 pydata-sphinx-theme==0.13.3 pygments==2.15.1 pyparsing==3.1.0 pyproject-api==1.5.2 pyrsistent==0.19.3 -pytest==7.3.2 +pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 python-constraint==1.4.0 @@ -192,7 +192,7 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.16 +sqlalchemy==2.0.17 stack-data==0.6.2 sympy==1.12 tabulate==0.9.0 @@ -211,14 +211,14 @@ tornado==6.3.2 tox==4.6.3 tqdm==4.65.0 traitlets==5.9.0 -typing-extensions==4.6.3 +typing-extensions==4.7.1 uri-template==1.3.0 urllib3==1.26.16 virtualenv==20.23.1 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.0 +websocket-client==1.6.1 werkzeug==2.3.6 wheel==0.40.0 widgetsnbextension==4.0.7 diff --git a/.constraints/py3.9.txt b/.constraints/py3.9.txt index a9786755..a9b8fea5 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -43,7 +43,7 @@ deprecated==1.2.14 distlib==0.3.6 dm-tree==0.1.8 docutils==0.19 -exceptiongroup==1.1.1 +exceptiongroup==1.1.2 execnet==1.9.0 executing==1.2.0 fastjsonschema==2.17.1 @@ -52,47 +52,47 @@ flatbuffers==23.5.26 fonttools==4.40.0 fqdn==1.5.1 gast==0.4.0 -google-auth==2.20.0 +google-auth==2.21.0 google-auth-oauthlib==1.0.0 google-pasta==0.2.0 graphviz==0.20.1 greenlet==2.0.2 -grpcio==1.54.2 +grpcio==1.56.0 h5py==3.9.0 hepunits==2.3.2 identify==2.5.24 idna==3.4 imagesize==1.4.1 -iminuit==2.21.3 +iminuit==2.22.0 importlib-metadata==6.7.0 importlib-resources==5.12.0 iniconfig==2.0.0 -ipykernel==6.23.2 +ipykernel==6.24.0 ipympl==0.9.3 ipython==8.14.0 ipython-genutils==0.2.0 ipywidgets==8.0.6 isoduration==20.11.0 isort==5.12.0 -jax==0.4.12 -jaxlib==0.4.12 +jax==0.4.13 +jaxlib==0.4.13 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 jsonschema==4.17.3 jupyter-cache==0.6.1 -jupyter-client==8.2.0 +jupyter-client==8.3.0 jupyter-core==5.3.1 jupyter-events==0.6.3 -jupyter-server==2.6.0 +jupyter-server==2.7.0 jupyter-server-fileid==0.9.0 jupyter-server-terminals==0.4.4 jupyter-server-ydoc==0.8.0 jupyter-ydoc==0.2.4 -jupyterlab==3.6.4 +jupyterlab==3.6.5 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==1.2.0 +jupyterlab-myst==2.0.0 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 jupyterlab-widgets==3.0.7 @@ -130,13 +130,13 @@ overrides==7.3.1 packaging==23.1 pandocfilters==1.5.0 parso==0.8.3 -particle==0.22.1 +particle==0.23.0 pathspec==0.11.1 pexpect==4.8.0 phasespace==1.8.0 pickleshare==0.7.5 -pillow==9.5.0 -platformdirs==3.7.0 +pillow==10.0.0 +platformdirs==3.8.0 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 @@ -150,13 +150,13 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.9 +pydantic==1.10.10 pydata-sphinx-theme==0.13.3 pygments==2.15.1 pyparsing==3.1.0 pyproject-api==1.5.2 pyrsistent==0.19.3 -pytest==7.3.2 +pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 python-constraint==1.4.0 @@ -170,7 +170,7 @@ requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rsa==4.9 -scipy==1.10.1 +scipy==1.11.1 send2trash==1.8.2 six==1.16.0 sniffio==1.3.0 @@ -190,7 +190,7 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.16 +sqlalchemy==2.0.17 stack-data==0.6.2 sympy==1.12 tabulate==0.9.0 @@ -209,14 +209,14 @@ tornado==6.3.2 tox==4.6.3 tqdm==4.65.0 traitlets==5.9.0 -typing-extensions==4.6.3 +typing-extensions==4.7.1 uri-template==1.3.0 urllib3==1.26.16 virtualenv==20.23.1 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.0 +websocket-client==1.6.1 werkzeug==2.3.6 wheel==0.40.0 widgetsnbextension==4.0.7 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e1cc061f..e4b09824 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -115,7 +115,7 @@ repos: - --py37-plus - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "" + rev: "v0.0.276" hooks: - id: ruff args: From a957f7e92153376a50b30886b5eab2ae947abc26 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 08:21:36 +0000 Subject: [PATCH 05/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/jpsi2ksp.ipynb | 4 +--- docs/lc2pkpi.ipynb | 4 +--- src/ampform_dpd/__init__.py | 19 +++++++------------ src/ampform_dpd/_attrs.py | 4 +--- src/ampform_dpd/angles.py | 17 ++++++++--------- src/ampform_dpd/decay.py | 16 ++++++++++------ src/ampform_dpd/io.py | 6 +++--- 7 files changed, 31 insertions(+), 39 deletions(-) diff --git a/docs/jpsi2ksp.ipynb b/docs/jpsi2ksp.ipynb index 2dfa7cba..620b819c 100644 --- a/docs/jpsi2ksp.ipynb +++ b/docs/jpsi2ksp.ipynb @@ -473,9 +473,7 @@ " if decay_masses == {m1, m2}:\n", " return s3\n", " msg = f\"Cannot find Mandelstam variable for {''.join(decay_masses)}\"\n", - " raise NotImplementedError(\n", - " msg\n", - " )" + " raise NotImplementedError(msg)" ] }, { diff --git a/docs/lc2pkpi.ipynb b/docs/lc2pkpi.ipynb index a79a3658..cee23f16 100644 --- a/docs/lc2pkpi.ipynb +++ b/docs/lc2pkpi.ipynb @@ -308,9 +308,7 @@ " if decay_masses == {m1, m2}:\n", " return s3\n", " msg = f\"Cannot find Mandelstam variable for {''.join(decay_masses)}\"\n", - " raise NotImplementedError(\n", - " msg\n", - " )\n", + " raise NotImplementedError(msg)\n", "\n", "\n", "def _to_mass_symbol(particle: Particle) -> sp.Symbol:\n", diff --git a/src/ampform_dpd/__init__.py b/src/ampform_dpd/__init__.py index cbe5b367..6bc9b4e0 100644 --- a/src/ampform_dpd/__init__.py +++ b/src/ampform_dpd/__init__.py @@ -310,16 +310,12 @@ def __get_chain(self, identifier) -> ThreeBodyDecayChain: chain = identifier if chain not in set(self.__decay.chains): msg = f"Decay does not have chain with resonance {chain.resonance.name}" - raise ValueError( - msg - ) + raise ValueError(msg) return chain if isinstance(identifier, str): return self.__decay.find_chain(identifier) msg = f"Cannot get decay chain for identifier type {type(identifier)}" - raise NotImplementedError( - msg - ) + raise NotImplementedError(msg) @property def decay(self) -> ThreeBodyDecay: @@ -356,9 +352,7 @@ def _formulate_clebsch_gordan_factors( ) -> sp.Expr: if isobar.interaction is None: msg = "Cannot formulate amplitude model in LS-basis if LS-couplings are missing" - raise ValueError( - msg - ) + raise ValueError(msg) # https://github.com/ComPWA/ampform/blob/65b4efa/src/ampform/helicity/__init__.py#L785-L802 # and supplementary material p.1 (https://cds.cern.ch/record/2824328/files) child1 = _get_particle(isobar.child1) @@ -399,10 +393,11 @@ def formulate_polarimetry( ) -> tuple[PoolSum, PoolSum, PoolSum]: half = sp.Rational(1, 2) if builder.decay.initial_state.spin != half: - msg = f"Can only formulate polarimetry for an initial state with spin 1/2, but got {builder.decay.initial_state.spin}" - raise ValueError( - msg + msg = ( + "Can only formulate polarimetry for an initial state with spin 1/2, but" + f" got {builder.decay.initial_state.spin}" ) + raise ValueError(msg) model = builder.formulate(reference_subsystem) λ0, λ0_prime = sp.symbols(R"lambda \lambda^{\prime}", rational=True) λ = { diff --git a/src/ampform_dpd/_attrs.py b/src/ampform_dpd/_attrs.py index 1a88e18d..509eb3d6 100644 --- a/src/ampform_dpd/_attrs.py +++ b/src/ampform_dpd/_attrs.py @@ -14,9 +14,7 @@ def assert_spin_value(instance, attribute: Attribute, value: sp.Rational) -> None: if value.denominator not in {1, 2}: msg = f"{attribute.name} value should be integer or half-integer, not {value}" - raise ValueError( - msg - ) + raise ValueError(msg) def to_ls(obj: LSCoupling | tuple[int, SupportsFloat] | None) -> LSCoupling: diff --git a/src/ampform_dpd/angles.py b/src/ampform_dpd/angles.py index b1e268b9..5a491000 100644 --- a/src/ampform_dpd/angles.py +++ b/src/ampform_dpd/angles.py @@ -20,9 +20,7 @@ def formulate_scattering_angle( # pyright: ignore[reportUnnecessaryContains] if {state_id, sibling_id} in {(2, 1), (3, 2), (1, 3)}: msg = f"Cannot compute scattering angle θ{state_id}{sibling_id}" - raise NotImplementedError( - msg - ) + raise NotImplementedError(msg) if state_id == sibling_id: msg = f"IDs of the decay products cannot be equal: {state_id}" raise ValueError(msg) @@ -54,9 +52,7 @@ def formulate_theta_hat_angle( allowed_ids = {1, 2, 3} if not {isobar_id, aligned_subsystem} <= allowed_ids: msg = f"Child IDs need to be one of {', '.join(map(str, allowed_ids))}" - raise ValueError( - msg - ) + raise ValueError(msg) symbol = sp.Symbol(Rf"\hat\theta_{isobar_id}({aligned_subsystem})", real=True) if isobar_id == aligned_subsystem: return symbol, sp.S.Zero @@ -162,8 +158,10 @@ def formulate_zeta_angle( (2, 3, 1), (3, 1, 2), }: + def create_symbols(i): return sp.symbols(f"m{i} sigma{i}", nonnegative=True) + mi, σi = create_symbols(rotated_state) mj, σj = create_symbols(aligned_subsystem) mk, σk = create_symbols(reference_subsystem) @@ -190,7 +188,8 @@ def create_symbols(i): rotated_state, reference_subsystem, aligned_subsystem ) return zeta_symbol, -zeta - msg = f"No expression for ζ^{rotated_state}_{aligned_subsystem}({reference_subsystem})" - raise NotImplementedError( - msg + msg = ( + "No expression for" + f" ζ^{rotated_state}_{aligned_subsystem}({reference_subsystem})" ) + raise NotImplementedError(msg) diff --git a/src/ampform_dpd/decay.py b/src/ampform_dpd/decay.py index 095c5e68..56a67190 100644 --- a/src/ampform_dpd/decay.py +++ b/src/ampform_dpd/decay.py @@ -50,18 +50,22 @@ def __attrs_post_init__(self) -> None: expected_final_state = set(self.final_state.values()) for i, chain in enumerate(self.chains): if chain.parent != expected_initial_state: - msg = f"Chain {i} has initial state {chain.parent.name}, but should have {expected_initial_state.name}" - raise ValueError( - msg + msg = ( + f"Chain {i} has initial state {chain.parent.name}, but should have" + f" {expected_initial_state.name}" ) + raise ValueError(msg) final_state = {chain.spectator, *chain.decay_products} if final_state != expected_final_state: + def to_str(s): return ", ".join(p.name for p in s) - msg = f"Chain {i} has final state {to_str(final_state)}, but should have {to_str(expected_final_state)}" - raise ValueError( - msg + + msg = ( + f"Chain {i} has final state {to_str(final_state)}, but should have" + f" {to_str(expected_final_state)}" ) + raise ValueError(msg) @property def initial_state(self) -> Particle: diff --git a/src/ampform_dpd/io.py b/src/ampform_dpd/io.py index 927e2fde..f0b38678 100644 --- a/src/ampform_dpd/io.py +++ b/src/ampform_dpd/io.py @@ -142,10 +142,10 @@ def as_markdown_table(obj: Sequence) -> str: return _as_decay_markdown_table(obj.chains) if item_type is ThreeBodyDecayChain: return _as_decay_markdown_table(obj) - msg = f"Cannot render a sequence with {item_type.__name__} items as a Markdown table" - raise NotImplementedError( - msg + msg = ( + f"Cannot render a sequence with {item_type.__name__} items as a Markdown table" ) + raise NotImplementedError(msg) def _determine_item_type(obj) -> type: From e98647f8921166fa136dbbc37fbcf7bfc4a59b50 Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 4 Jul 2023 08:32:46 +0000 Subject: [PATCH 06/26] MAINT: implement updates from pre-commit hooks --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f660b677..f2ca2ac2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -155,12 +155,12 @@ ignore = [ "SIM108", ] show-fixes = true -target-version = "py37" -task-tags = ["cspell"] src = [ "src", "tests", ] +target-version = "py37" +task-tags = ["cspell"] [tool.ruff.per-file-ignores] "docs/*" = [ From 63b3c36a7293a343ea8f32ae7dfb361280b18915 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Thu, 6 Jul 2023 22:42:28 +0200 Subject: [PATCH 07/26] MAINT: autoupdate pre-commit config --- .pre-commit-config.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e4b09824..2f83ce42 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.0.184 + rev: 0.0.186 hooks: - id: check-dev-files args: @@ -47,7 +47,6 @@ repos: - id: nbqa-pyupgrade args: - --py37-plus - - id: nbqa-ruff args: - --fix @@ -98,7 +97,7 @@ repos: metadata.vscode - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.9-for-vscode + rev: v3.0.0 hooks: - id: prettier @@ -115,7 +114,7 @@ repos: - --py37-plus - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.0.276" + rev: v0.0.277 hooks: - id: ruff args: From a6f72bd675265529706fc7813725797012c1fc3b Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Thu, 6 Jul 2023 22:42:49 +0200 Subject: [PATCH 08/26] MAINT: move badge to correct position --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 015f303d..7f496f47 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # Symbolic Dalitz-Plot Decomposition -[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![GPLv3+ license](https://img.shields.io/badge/License-GPLv3+-blue.svg)](https://www.gnu.org/licenses/gpl-3.0-standalone.html) [![PyPI package](https://badge.fury.io/py/ampform-dpd.svg)](https://pypi.org/project/ampform-dpd) @@ -13,6 +12,7 @@ [![GitPod](https://img.shields.io/badge/gitpod-open-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ComPWA/ampform-dpd) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) [![Spelling checked](https://img.shields.io/badge/cspell-checked-brightgreen.svg)](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell) +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) This repository is a (temporary) extension of [AmpForm](https://ampform.rtfd.io) and provides a symbolic implementation of Dalitz-plot decomposition ([10.1103/PhysRevD.101.034033](https://journals.aps.org/prd/abstract/10.1103/PhysRevD.101.034033)) with [SymPy](https://www.sympy.org/en/index.html). It has been extracted from the [ComPWA/polarimetry](https://github.com/ComPWA/polarimetry) repository, which is not yet public. From e66af1e98d2a964ef903f3a4f28dc4f695e0064a Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Thu, 6 Jul 2023 22:43:06 +0200 Subject: [PATCH 09/26] DX: add Ruff as requirement --- setup.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 01a1f626..1c47fbb4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -83,9 +83,11 @@ test = pytest-xdist format = black - isort +lint = + ruff sty = %(format)s + %(lint)s %(test)s # for pytest type hints docutils pre-commit >=1.4.0 From 1f2afcb550fd3c75e32ba7d39b7955df5d7cf634 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Thu, 6 Jul 2023 22:49:55 +0200 Subject: [PATCH 10/26] MAINT: address Ruff issues --- docs/_relink_references.py | 2 +- docs/_unsrt_et_al.py | 12 ++--- docs/comparison/d2kkk.ipynb | 2 +- docs/comparison/jpsi2phipipi.ipynb | 2 +- docs/conf.py | 4 +- pyproject.toml | 75 +++++++++++++++++------------- src/ampform_dpd/__init__.py | 9 ++-- src/ampform_dpd/angles.py | 2 +- src/ampform_dpd/decay.py | 4 +- src/ampform_dpd/dynamics.py | 2 +- src/ampform_dpd/spin.py | 2 +- 11 files changed, 60 insertions(+), 56 deletions(-) diff --git a/docs/_relink_references.py b/docs/_relink_references.py index a66c6515..4f36408b 100644 --- a/docs/_relink_references.py +++ b/docs/_relink_references.py @@ -37,7 +37,7 @@ def _new_type_to_xref( target: str, - env: BuildEnvironment = None, + env: BuildEnvironment | None = None, suppress_prefix: bool = False, ) -> pending_xref: reftype, target, title, refspecific = parse_reftarget(target, suppress_prefix) diff --git a/docs/_unsrt_et_al.py b/docs/_unsrt_et_al.py index 7d23a167..6ccfce50 100644 --- a/docs/_unsrt_et_al.py +++ b/docs/_unsrt_et_al.py @@ -22,8 +22,7 @@ def format_names(self, role: Entry, as_sentence: bool = True) -> Node: formatted_names = names(role, sep=", ", sep2=" and ", last_sep=", and ") if as_sentence: return sentence[formatted_names] - else: - return formatted_names + return formatted_names def format_eprint(self, e: Entry) -> Node: if "doi" in e.fields: @@ -62,12 +61,11 @@ def et_al(children, data, sep="", sep2=None, last_sep=None): parts = [part for part in _format_list(children, data) if part] if len(parts) <= 1: return Text(*parts) - elif len(parts) == 2: + if len(parts) == 2: return Text(sep2).join(parts) - elif len(parts) == 3: + if len(parts) == 3: return Text(last_sep).join([Text(sep).join(parts[:-1]), parts[-1]]) - else: - return Text(parts[0], Tag("em", " et al")) + return Text(parts[0], Tag("em", " et al")) @node # pyright: ignore[reportUntypedFunctionDecorator] @@ -77,7 +75,7 @@ def names(children, context, role, **kwargs): try: persons = context["entry"].persons[role] except KeyError: - raise FieldIsMissing(role, context["entry"]) + raise FieldIsMissing(role, context["entry"]) from None style = context["style"] formatted_names = [ diff --git a/docs/comparison/d2kkk.ipynb b/docs/comparison/d2kkk.ipynb index 0628f592..c12e2ca3 100644 --- a/docs/comparison/d2kkk.ipynb +++ b/docs/comparison/d2kkk.ipynb @@ -650,7 +650,7 @@ "source": [ "def create_sliders() -> dict[str, ToggleButtons]:\n", " all_parameters = dict(ampform_model.parameter_defaults.items())\n", - " all_parameters.update(dict(dpd_model.parameter_defaults.items()))\n", + " all_parameters.update(dpd_model.parameter_defaults.items())\n", " sliders = {}\n", " for symbol, value in all_parameters.items():\n", " value = \"+1\"\n", diff --git a/docs/comparison/jpsi2phipipi.ipynb b/docs/comparison/jpsi2phipipi.ipynb index 4013353f..459ae95c 100644 --- a/docs/comparison/jpsi2phipipi.ipynb +++ b/docs/comparison/jpsi2phipipi.ipynb @@ -633,7 +633,7 @@ "source": [ "def create_sliders() -> dict[str, ToggleButtons]:\n", " all_parameters = dict(ampform_model.parameter_defaults.items())\n", - " all_parameters.update(dict(dpd_model.parameter_defaults.items()))\n", + " all_parameters.update(dpd_model.parameter_defaults.items())\n", " sliders = {}\n", " for symbol, value in all_parameters.items():\n", " value = \"+1\"\n", diff --git a/docs/conf.py b/docs/conf.py index 19ba096f..a533ac6b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -79,7 +79,7 @@ def generate_api() -> None: "--templatedir _templates", ] ), - shell=True, + shell=True, # noqa: S602 ) @@ -113,7 +113,7 @@ def generate_api() -> None: "references.bib", ] codeautolink_concat_default = True -copyright = "2022" +copyright = "2022" # noqa: A001 default_role = "py:obj" exclude_patterns = [ "**.ipynb_checkpoints", diff --git a/pyproject.toml b/pyproject.toml index f2ca2ac2..64795b7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,9 +33,7 @@ target-version = [ ] [tool.nbqa.addopts] -black = [ - "--line-length=85", -] +black = ["--line-length=85"] ruff = [ "--extend-ignore=B018", "--extend-ignore=C90", @@ -46,9 +44,31 @@ ruff = [ "--extend-ignore=PLR2004", "--extend-ignore=PLW0602", "--extend-ignore=PLW0603", + "--extend-ignore=PLW2901", "--line-length=85", ] +[tool.pyright] +reportGeneralTypeIssues = false +reportImportCycles = false +reportIncompatibleMethodOverride = false +reportMissingParameterType = false +reportMissingTypeArgument = false +reportMissingTypeStubs = false +reportPrivateImportUsage = false +reportUnknownArgumentType = false +reportUnknownLambdaType = false +reportUnknownMemberType = false +reportUnknownParameterType = false +reportUnknownVariableType = false +reportUnnecessaryContains = false +reportUnnecessaryIsInstance = false +reportUnusedClass = true +reportUnusedFunction = true +reportUnusedImport = true +reportUnusedVariable = true +typeCheckingMode = "strict" + [tool.nbqa.exclude] flake8 = "^docs/appendix/benchmark.ipynb" @@ -78,36 +98,6 @@ testpaths = [ "tests", ] -[tool.pyright] -exclude = [ - "**/.git", - "**/.ipynb_checkpoints", - "**/.mypy_cache", - "**/.pytest_cache", - "**/.tox", - "**/__pycache__", - "**/_build", -] -reportGeneralTypeIssues = false -reportImportCycles = false -reportIncompatibleMethodOverride = false -reportMissingParameterType = false -reportMissingTypeArgument = false -reportMissingTypeStubs = false -reportPrivateImportUsage = false -reportUnknownArgumentType = false -reportUnknownLambdaType = false -reportUnknownMemberType = false -reportUnknownParameterType = false -reportUnknownVariableType = false -reportUnnecessaryContains = false -reportUnnecessaryIsInstance = false -reportUnusedClass = true -reportUnusedFunction = true -reportUnusedImport = true -reportUnusedVariable = true -typeCheckingMode = "strict" - [tool.ruff] extend-select = [ "A", @@ -142,6 +132,7 @@ extend-select = [ "YTT", ] ignore = [ + "B028", # missing explicit stacklevel keyword "D101", "D102", "D103", @@ -152,6 +143,9 @@ ignore = [ "D407", "D416", "E501", + "ISC003", + "PLR0913", # sympy class + "S301", "SIM108", ] show-fixes = true @@ -163,9 +157,11 @@ target-version = "py37" task-tags = ["cspell"] [tool.ruff.per-file-ignores] +"*" = ["D"] "docs/*" = [ "E402", "INP001", + "PLR2004", "S101", "S113", "T201", @@ -180,5 +176,18 @@ task-tags = ["cspell"] "S101", ] +[tool.ruff.pep8-naming] +ignore-names = [ + "A", + "H", + "L", + "R", + "R_dec", + "R_prod", + "S", + "Γ*", + "λ*", +] + [tool.ruff.pydocstyle] convention = "google" diff --git a/src/ampform_dpd/__init__.py b/src/ampform_dpd/__init__.py index 6bc9b4e0..d1d15fc8 100644 --- a/src/ampform_dpd/__init__.py +++ b/src/ampform_dpd/__init__.py @@ -65,17 +65,14 @@ def __init__( if isinstance(min_ls, bool): self.use_production_helicity_couplings = min_ls self.use_decay_helicity_couplings = min_ls - elif isinstance(min_ls, tuple) and len(min_ls) == 2: + elif isinstance(min_ls, tuple) and len(min_ls) == 2: # noqa: PLR2004 ( self.use_production_helicity_couplings, self.use_decay_helicity_couplings, ) = min_ls else: msg = f"Cannot configure helicity couplings with a {type(min_ls).__name__}" - raise NotImplementedError( - msg, - min_ls, - ) + raise NotImplementedError(msg, min_ls) def formulate( self, @@ -338,7 +335,7 @@ def formulate_non_resonant( def simplify_latex_rendering() -> None: """Improve LaTeX rendering of an `~sympy.tensor.indexed.Indexed` object.""" - def _print_Indexed_latex(self, printer, *args): + def _print_Indexed_latex(self, printer, *args): # noqa: N802 base = printer._print(self.base) indices = ", ".join(map(printer._print, self.indices)) return f"{base}_{{{indices}}}" diff --git a/src/ampform_dpd/angles.py b/src/ampform_dpd/angles.py index 5a491000..224d3a47 100644 --- a/src/ampform_dpd/angles.py +++ b/src/ampform_dpd/angles.py @@ -79,7 +79,7 @@ def formulate_theta_hat_angle( return symbol, -theta -def formulate_zeta_angle( +def formulate_zeta_angle( # noqa: C901, PLR0911 rotated_state: int, aligned_subsystem: int, reference_subsystem: int, diff --git a/src/ampform_dpd/decay.py b/src/ampform_dpd/decay.py index 56a67190..93e17e13 100644 --- a/src/ampform_dpd/decay.py +++ b/src/ampform_dpd/decay.py @@ -97,9 +97,9 @@ def get_subsystem(self, subsystem_id: Literal[1, 2, 3]) -> ThreeBodyDecay: def get_decay_product_ids(spectator_id: Literal[1, 2, 3]) -> tuple[int, int]: if spectator_id == 1: return 2, 3 - if spectator_id == 2: + if spectator_id == 2: # noqa: PLR2004 return 3, 1 - if spectator_id == 3: + if spectator_id == 3: # noqa: PLR2004 return 1, 2 msg = f"Spectator ID has to be one of 1, 2, 3, not {spectator_id}" raise ValueError(msg) diff --git a/src/ampform_dpd/dynamics.py b/src/ampform_dpd/dynamics.py index a085f6c2..35c83818 100644 --- a/src/ampform_dpd/dynamics.py +++ b/src/ampform_dpd/dynamics.py @@ -106,7 +106,7 @@ def __new__(cls, s, m0, Γ0, m1, m2, γ): def evaluate(self): s, m0, Γ0, m1, m2, γ = self.args - s_A = m1**2 - m2**2 / 2 # Adler zero + s_A = m1**2 - m2**2 / 2 # Adler zero # noqa: N806 g_squared = sp.Mul( (s - s_A) / (m0**2 - s_A), m0 * Γ0 * sp.exp(-γ * s), diff --git a/src/ampform_dpd/spin.py b/src/ampform_dpd/spin.py index 6de5ed41..6c651367 100644 --- a/src/ampform_dpd/spin.py +++ b/src/ampform_dpd/spin.py @@ -10,7 +10,7 @@ def generate_ls_couplings( parent_spin: SupportsFloat, child1_spin: SupportsFloat, child2_spin: SupportsFloat, - max_L: int = 3, + max_L: int = 3, # noqa: N803 ) -> list[tuple[int, sp.Rational]]: r""">>> generate_ls_couplings(1.5, 0.5, 0) [(1, 1/2), (2, 1/2)]. From 0480af41ad6f68c005912cc4f445d8233b2909ce Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Thu, 6 Jul 2023 22:54:49 +0200 Subject: [PATCH 11/26] FIX: revert autofixes of pydocstyle issues --- src/ampform_dpd/spin.py | 20 ++++++++++++-------- tests/test_angles.py | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/ampform_dpd/spin.py b/src/ampform_dpd/spin.py index 6c651367..c25258c3 100644 --- a/src/ampform_dpd/spin.py +++ b/src/ampform_dpd/spin.py @@ -12,8 +12,9 @@ def generate_ls_couplings( child2_spin: SupportsFloat, max_L: int = 3, # noqa: N803 ) -> list[tuple[int, sp.Rational]]: - r""">>> generate_ls_couplings(1.5, 0.5, 0) - [(1, 1/2), (2, 1/2)]. + r""" + >>> generate_ls_couplings(1.5, 0.5, 0) + [(1, 1/2), (2, 1/2)] """ s1 = float(child1_spin) s2 = float(child2_spin) @@ -34,11 +35,12 @@ def filter_parity_violating_ls( child1_parity: SupportsInt, child2_parity: SupportsInt, ) -> list[tuple[int, sp.Rational]]: - r""">>> LS = generate_ls_couplings(0.5, 1.5, 0) # Λc → Λ(1520)π + r""" + >>> LS = generate_ls_couplings(0.5, 1.5, 0) # Λc → Λ(1520)π >>> LS [(1, 3/2), (2, 3/2)] >>> filter_parity_violating_ls(LS, +1, -1, -1) - [(2, 3/2)]. + [(2, 3/2)] """ η0, η1, η2 = ( int(parent_parity), @@ -49,8 +51,9 @@ def filter_parity_violating_ls( def create_spin_range(spin: SupportsFloat) -> list[sp.Rational]: - """>>> create_spin_range(1.5) - [-3/2, -1/2, 1/2, 3/2]. + """ + >>> create_spin_range(1.5) + [-3/2, -1/2, 1/2, 3/2] """ return create_rational_range(-spin, spin) @@ -58,8 +61,9 @@ def create_spin_range(spin: SupportsFloat) -> list[sp.Rational]: def create_rational_range( __from: SupportsFloat, __to: SupportsFloat ) -> list[sp.Rational]: - """>>> create_rational_range(-0.5, +1.5) - [-1/2, 1/2, 3/2]. + """ + >>> create_rational_range(-0.5, +1.5) + [-1/2, 1/2, 3/2] """ spin_range = arange(float(__from), +float(__to) + 0.5) return list(map(sp.Rational, spin_range)) diff --git a/tests/test_angles.py b/tests/test_angles.py index ca8eb2cc..efef4763 100644 --- a/tests/test_angles.py +++ b/tests/test_angles.py @@ -52,7 +52,7 @@ def test_formulate_theta_hat_angle(): assert formulate_theta_hat_angle(i, i)[1] == 0 -def test_formulate_zeta_angle_equation_A6(): +def test_formulate_zeta_angle_equation_A6(): # noqa: N802 """Test Eq. (A6), https://journals.aps.org/prd/pdf/10.1103/PhysRevD.101.034033#page=10.""" for i in [1, 2, 3]: for k in [1, 2, 3]: From 6a3e141147cc0da7019e5f44cc693bdbb3b2e98d Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Thu, 6 Jul 2023 23:05:46 +0200 Subject: [PATCH 12/26] MAINT: relink intersphinx objects after `TYPE_CHECKING` insertion --- docs/_relink_references.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/_relink_references.py b/docs/_relink_references.py index 4f36408b..98fe0dc3 100644 --- a/docs/_relink_references.py +++ b/docs/_relink_references.py @@ -19,10 +19,14 @@ from sphinx.environment import BuildEnvironment __TARGET_SUBSTITUTIONS = { + "Literal[(-1, 1)]": "typing.Literal", "Literal[- 1, 1]": "typing.Literal", "Literal[-1, 1]": "typing.Literal", "OuterStates": "ampform_dpd.decay.OuterStates", + "ParameterValue": "tensorwaves.interface.ParameterValue", + "ParametrizedBackendFunction": "tensorwaves.function.ParametrizedBackendFunction", "PoolSum": "ampform.sympy.PoolSum", + "PositionalArgumentFunction": "tensorwaves.function.PositionalArgumentFunction", "sp.Expr": "sympy.core.expr.Expr", "sp.Indexed": "sympy.tensor.indexed.Indexed", "sp.Rational": "sympy.core.numbers.Rational", @@ -32,6 +36,7 @@ } __REF_TYPE_SUBSTITUTIONS = { "ampform_dpd.decay.OuterStates": "obj", + "tensorwaves.interface.ParameterValue": "obj", } From 45a9c66bff980c9b3f022d848a140333fb31487c Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 6 Jul 2023 21:09:59 +0000 Subject: [PATCH 13/26] MAINT: update pip constraints and pre-commit --- .constraints/py3.10.txt | 48 +++++++++++++++++++++-------------------- .constraints/py3.11.txt | 48 +++++++++++++++++++++-------------------- .constraints/py3.7.txt | 24 ++++++++++----------- .constraints/py3.8.txt | 48 +++++++++++++++++++++-------------------- .constraints/py3.9.txt | 48 +++++++++++++++++++++-------------------- 5 files changed, 112 insertions(+), 104 deletions(-) diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt index d0b16229..447fee1b 100644 --- a/.constraints/py3.10.txt +++ b/.constraints/py3.10.txt @@ -10,7 +10,7 @@ aiofiles==22.1.0 aiosqlite==0.19.0 alabaster==0.7.13 ampform==0.14.6 -anyio==3.7.0 +anyio==3.7.1 aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 @@ -29,7 +29,7 @@ cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.1.0 -click==8.1.3 +click==8.1.4 cloudpickle==2.2.1 colorama==0.4.6 comm==0.1.3 @@ -70,16 +70,16 @@ ipykernel==6.24.0 ipympl==0.9.3 ipython==8.14.0 ipython-genutils==0.2.0 -ipywidgets==8.0.6 +ipywidgets==8.0.7 isoduration==20.11.0 -isort==5.12.0 jax==0.4.13 jaxlib==0.4.13 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.17.3 +jsonschema==4.18.0 +jsonschema-specifications==2023.6.1 jupyter-cache==0.6.1 jupyter-client==8.3.0 jupyter-core==5.3.1 @@ -91,11 +91,11 @@ jupyter-server-ydoc==0.8.0 jupyter-ydoc==0.2.4 jupyterlab==3.6.5 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==2.0.0 +jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 -jupyterlab-widgets==3.0.7 -keras==2.12.0 +jupyterlab-widgets==3.0.8 +keras==2.13.1 kiwisolver==1.4.4 latexcodec==2.0.1 libclang==16.0.0 @@ -103,7 +103,7 @@ livereload==2.6.3 markdown==3.4.3 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.7.1 +matplotlib==3.7.2 matplotlib-inline==0.1.6 mdit-py-plugins==0.3.5 mdurl==0.1.2 @@ -122,7 +122,7 @@ nest-asyncio==1.5.6 nodeenv==1.8.0 notebook==6.5.4 notebook-shim==0.2.3 -numpy==1.23.5 +numpy==1.24.3 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.3.1 @@ -139,7 +139,7 @@ platformdirs==3.8.0 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.39 protobuf==4.23.3 psutil==5.9.5 ptyprocess==0.7.0 @@ -149,12 +149,11 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.10 +pydantic==1.10.11 pydata-sphinx-theme==0.13.3 pygments==2.15.1 -pyparsing==3.1.0 -pyproject-api==1.5.2 -pyrsistent==0.19.3 +pyparsing==3.0.9 +pyproject-api==1.5.3 pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 @@ -164,11 +163,14 @@ python-json-logger==2.0.7 pyyaml==6.0 pyzmq==25.1.0 qrules==0.9.8 +referencing==0.29.1 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 +rpds-py==0.8.8 rsa==4.9 +ruff==0.0.277 scipy==1.11.1 send2trash==1.8.2 six==1.16.0 @@ -189,14 +191,14 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.17 +sqlalchemy==2.0.18 stack-data==0.6.2 sympy==1.12 tabulate==0.9.0 -tensorboard==2.12.3 +tensorboard==2.13.0 tensorboard-data-server==0.7.1 -tensorflow==2.12.0 -tensorflow-estimator==2.12.0 +tensorflow==2.13.0 +tensorflow-estimator==2.13.0 tensorflow-io-gcs-filesystem==0.32.0 tensorflow-probability==0.18.0 tensorwaves==0.4.10 @@ -205,10 +207,10 @@ terminado==0.17.1 tinycss2==1.2.1 tomli==2.0.1 tornado==6.3.2 -tox==4.6.3 +tox==4.6.4 tqdm==4.65.0 traitlets==5.9.0 -typing-extensions==4.7.1 +typing-extensions==4.5.0 uri-template==1.3.0 urllib3==1.26.16 virtualenv==20.23.1 @@ -218,8 +220,8 @@ webencodings==0.5.1 websocket-client==1.6.1 werkzeug==2.3.6 wheel==0.40.0 -widgetsnbextension==4.0.7 -wrapt==1.14.1 +widgetsnbextension==4.0.8 +wrapt==1.15.0 y-py==0.5.9 ypy-websocket==0.8.2 zipp==3.15.0 diff --git a/.constraints/py3.11.txt b/.constraints/py3.11.txt index 2fa3fb8d..2eae86f0 100644 --- a/.constraints/py3.11.txt +++ b/.constraints/py3.11.txt @@ -10,7 +10,7 @@ aiofiles==22.1.0 aiosqlite==0.19.0 alabaster==0.7.13 ampform==0.14.6 -anyio==3.7.0 +anyio==3.7.1 aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 @@ -29,7 +29,7 @@ cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.1.0 -click==8.1.3 +click==8.1.4 cloudpickle==2.2.1 colorama==0.4.6 comm==0.1.3 @@ -69,16 +69,16 @@ ipykernel==6.24.0 ipympl==0.9.3 ipython==8.14.0 ipython-genutils==0.2.0 -ipywidgets==8.0.6 +ipywidgets==8.0.7 isoduration==20.11.0 -isort==5.12.0 jax==0.4.13 jaxlib==0.4.13 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.17.3 +jsonschema==4.18.0 +jsonschema-specifications==2023.6.1 jupyter-cache==0.6.1 jupyter-client==8.3.0 jupyter-core==5.3.1 @@ -90,11 +90,11 @@ jupyter-server-ydoc==0.8.0 jupyter-ydoc==0.2.4 jupyterlab==3.6.5 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==2.0.0 +jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 -jupyterlab-widgets==3.0.7 -keras==2.12.0 +jupyterlab-widgets==3.0.8 +keras==2.13.1 kiwisolver==1.4.4 latexcodec==2.0.1 libclang==16.0.0 @@ -102,7 +102,7 @@ livereload==2.6.3 markdown==3.4.3 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.7.1 +matplotlib==3.7.2 matplotlib-inline==0.1.6 mdit-py-plugins==0.3.5 mdurl==0.1.2 @@ -121,7 +121,7 @@ nest-asyncio==1.5.6 nodeenv==1.8.0 notebook==6.5.4 notebook-shim==0.2.3 -numpy==1.23.5 +numpy==1.24.3 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.3.1 @@ -138,7 +138,7 @@ platformdirs==3.8.0 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.39 protobuf==4.23.3 psutil==5.9.5 ptyprocess==0.7.0 @@ -148,12 +148,11 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.10 +pydantic==1.10.11 pydata-sphinx-theme==0.13.3 pygments==2.15.1 -pyparsing==3.1.0 -pyproject-api==1.5.2 -pyrsistent==0.19.3 +pyparsing==3.0.9 +pyproject-api==1.5.3 pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 @@ -163,11 +162,14 @@ python-json-logger==2.0.7 pyyaml==6.0 pyzmq==25.1.0 qrules==0.9.8 +referencing==0.29.1 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 +rpds-py==0.8.8 rsa==4.9 +ruff==0.0.277 scipy==1.11.1 send2trash==1.8.2 six==1.16.0 @@ -188,14 +190,14 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.17 +sqlalchemy==2.0.18 stack-data==0.6.2 sympy==1.12 tabulate==0.9.0 -tensorboard==2.12.3 +tensorboard==2.13.0 tensorboard-data-server==0.7.1 -tensorflow==2.12.0 -tensorflow-estimator==2.12.0 +tensorflow==2.13.0 +tensorflow-estimator==2.13.0 tensorflow-io-gcs-filesystem==0.32.0 tensorflow-probability==0.18.0 tensorwaves==0.4.10 @@ -203,10 +205,10 @@ termcolor==2.3.0 terminado==0.17.1 tinycss2==1.2.1 tornado==6.3.2 -tox==4.6.3 +tox==4.6.4 tqdm==4.65.0 traitlets==5.9.0 -typing-extensions==4.7.1 +typing-extensions==4.5.0 uri-template==1.3.0 urllib3==1.26.16 virtualenv==20.23.1 @@ -216,8 +218,8 @@ webencodings==0.5.1 websocket-client==1.6.1 werkzeug==2.3.6 wheel==0.40.0 -widgetsnbextension==4.0.7 -wrapt==1.14.1 +widgetsnbextension==4.0.8 +wrapt==1.15.0 y-py==0.5.9 ypy-websocket==0.8.2 zipp==3.15.0 diff --git a/.constraints/py3.7.txt b/.constraints/py3.7.txt index 800035c2..e6bb0be5 100644 --- a/.constraints/py3.7.txt +++ b/.constraints/py3.7.txt @@ -10,7 +10,7 @@ aiofiles==22.1.0 aiosqlite==0.19.0 alabaster==0.7.13 ampform==0.14.6 -anyio==3.7.0 +anyio==3.7.1 aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 @@ -29,7 +29,7 @@ cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.1.0 -click==8.1.3 +click==8.1.4 cloudpickle==2.2.1 colorama==0.4.6 coverage==7.2.7 @@ -69,9 +69,8 @@ ipykernel==6.16.2 ipympl==0.9.3 ipython==7.34.0 ipython-genutils==0.2.0 -ipywidgets==8.0.6 +ipywidgets==8.0.7 isoduration==20.11.0 -isort==5.11.5 jax==0.3.25 jaxlib==0.3.25 jedi==0.18.2 @@ -92,7 +91,7 @@ jupyterlab-code-formatter==2.2.1 jupyterlab-myst==1.2.0 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 -jupyterlab-widgets==3.0.7 +jupyterlab-widgets==3.0.8 keras==2.11.0 kiwisolver==1.4.4 latexcodec==2.0.1 @@ -136,7 +135,7 @@ platformdirs==3.8.0 pluggy==1.2.0 pre-commit==2.21.0 prometheus-client==0.17.0 -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.39 protobuf==3.19.6 psutil==5.9.5 ptyprocess==0.7.0 @@ -145,11 +144,11 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.10 +pydantic==1.10.11 pydata-sphinx-theme==0.13.3 pygments==2.15.1 pyparsing==3.1.0 -pyproject-api==1.5.2 +pyproject-api==1.5.3 pyrsistent==0.19.3 pytest==7.4.0 pytest-cov==4.1.0 @@ -166,6 +165,7 @@ requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rsa==4.9 +ruff==0.0.277 scipy==1.7.3 send2trash==1.8.2 singledispatchmethod==1.0 @@ -187,7 +187,7 @@ sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==1.4.48 +sqlalchemy==1.4.49 sympy==1.10.1 tabulate==0.9.0 tensorboard==2.11.2 @@ -203,10 +203,10 @@ terminado==0.17.1 tinycss2==1.2.1 tomli==2.0.1 tornado==6.2 -tox==4.6.3 +tox==4.6.4 tqdm==4.65.0 traitlets==5.9.0 -typed-ast==1.5.4 +typed-ast==1.5.5 typing-extensions==4.7.1 ; python_version < "3.8.0" uri-template==1.3.0 urllib3==1.26.16 @@ -217,7 +217,7 @@ webencodings==0.5.1 websocket-client==1.6.1 werkzeug==2.2.3 wheel==0.40.0 -widgetsnbextension==4.0.7 +widgetsnbextension==4.0.8 wrapt==1.15.0 y-py==0.5.9 ypy-websocket==0.8.2 diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index dc890cad..10ab1b19 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -10,7 +10,7 @@ aiofiles==22.1.0 aiosqlite==0.19.0 alabaster==0.7.13 ampform==0.14.6 -anyio==3.7.0 +anyio==3.7.1 aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 @@ -29,7 +29,7 @@ cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.1.0 -click==8.1.3 +click==8.1.4 cloudpickle==2.2.1 colorama==0.4.6 comm==0.1.3 @@ -71,16 +71,16 @@ ipykernel==6.24.0 ipympl==0.9.3 ipython==8.12.2 ipython-genutils==0.2.0 -ipywidgets==8.0.6 +ipywidgets==8.0.7 isoduration==20.11.0 -isort==5.12.0 jax==0.4.13 jaxlib==0.4.13 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.17.3 +jsonschema==4.18.0 +jsonschema-specifications==2023.6.1 jupyter-cache==0.6.1 jupyter-client==8.3.0 jupyter-core==5.3.1 @@ -92,11 +92,11 @@ jupyter-server-ydoc==0.8.0 jupyter-ydoc==0.2.4 jupyterlab==3.6.5 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==2.0.0 +jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 -jupyterlab-widgets==3.0.7 -keras==2.12.0 +jupyterlab-widgets==3.0.8 +keras==2.13.1 kiwisolver==1.4.4 latexcodec==2.0.1 libclang==16.0.0 @@ -104,7 +104,7 @@ livereload==2.6.3 markdown==3.4.3 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.7.1 +matplotlib==3.7.2 matplotlib-inline==0.1.6 mdit-py-plugins==0.3.5 mdurl==0.1.2 @@ -123,7 +123,7 @@ nest-asyncio==1.5.6 nodeenv==1.8.0 notebook==6.5.4 notebook-shim==0.2.3 -numpy==1.23.5 +numpy==1.24.3 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.3.1 @@ -141,7 +141,7 @@ platformdirs==3.8.0 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.39 protobuf==4.23.3 psutil==5.9.5 ptyprocess==0.7.0 @@ -151,12 +151,11 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.10 +pydantic==1.10.11 pydata-sphinx-theme==0.13.3 pygments==2.15.1 -pyparsing==3.1.0 -pyproject-api==1.5.2 -pyrsistent==0.19.3 +pyparsing==3.0.9 +pyproject-api==1.5.3 pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 @@ -167,11 +166,14 @@ pytz==2023.3 pyyaml==6.0 pyzmq==25.1.0 qrules==0.9.8 +referencing==0.29.1 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 +rpds-py==0.8.8 rsa==4.9 +ruff==0.0.277 scipy==1.10.1 send2trash==1.8.2 six==1.16.0 @@ -192,14 +194,14 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.17 +sqlalchemy==2.0.18 stack-data==0.6.2 sympy==1.12 tabulate==0.9.0 -tensorboard==2.12.3 +tensorboard==2.13.0 tensorboard-data-server==0.7.1 -tensorflow==2.12.0 -tensorflow-estimator==2.12.0 +tensorflow==2.13.0 +tensorflow-estimator==2.13.0 tensorflow-io-gcs-filesystem==0.32.0 tensorflow-probability==0.18.0 tensorwaves==0.4.10 @@ -208,10 +210,10 @@ terminado==0.17.1 tinycss2==1.2.1 tomli==2.0.1 tornado==6.3.2 -tox==4.6.3 +tox==4.6.4 tqdm==4.65.0 traitlets==5.9.0 -typing-extensions==4.7.1 +typing-extensions==4.5.0 uri-template==1.3.0 urllib3==1.26.16 virtualenv==20.23.1 @@ -221,8 +223,8 @@ webencodings==0.5.1 websocket-client==1.6.1 werkzeug==2.3.6 wheel==0.40.0 -widgetsnbextension==4.0.7 -wrapt==1.14.1 +widgetsnbextension==4.0.8 +wrapt==1.15.0 y-py==0.5.9 ypy-websocket==0.8.2 zipp==3.15.0 diff --git a/.constraints/py3.9.txt b/.constraints/py3.9.txt index a9b8fea5..44671b69 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -10,7 +10,7 @@ aiofiles==22.1.0 aiosqlite==0.19.0 alabaster==0.7.13 ampform==0.14.6 -anyio==3.7.0 +anyio==3.7.1 aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 @@ -29,7 +29,7 @@ cffi==1.15.1 cfgv==3.3.1 chardet==5.1.0 charset-normalizer==3.1.0 -click==8.1.3 +click==8.1.4 cloudpickle==2.2.1 colorama==0.4.6 comm==0.1.3 @@ -71,16 +71,16 @@ ipykernel==6.24.0 ipympl==0.9.3 ipython==8.14.0 ipython-genutils==0.2.0 -ipywidgets==8.0.6 +ipywidgets==8.0.7 isoduration==20.11.0 -isort==5.12.0 jax==0.4.13 jaxlib==0.4.13 jedi==0.18.2 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.17.3 +jsonschema==4.18.0 +jsonschema-specifications==2023.6.1 jupyter-cache==0.6.1 jupyter-client==8.3.0 jupyter-core==5.3.1 @@ -92,11 +92,11 @@ jupyter-server-ydoc==0.8.0 jupyter-ydoc==0.2.4 jupyterlab==3.6.5 jupyterlab-code-formatter==2.2.1 -jupyterlab-myst==2.0.0 +jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 jupyterlab-server==2.23.0 -jupyterlab-widgets==3.0.7 -keras==2.12.0 +jupyterlab-widgets==3.0.8 +keras==2.13.1 kiwisolver==1.4.4 latexcodec==2.0.1 libclang==16.0.0 @@ -104,7 +104,7 @@ livereload==2.6.3 markdown==3.4.3 markdown-it-py==2.2.0 markupsafe==2.1.3 -matplotlib==3.7.1 +matplotlib==3.7.2 matplotlib-inline==0.1.6 mdit-py-plugins==0.3.5 mdurl==0.1.2 @@ -123,7 +123,7 @@ nest-asyncio==1.5.6 nodeenv==1.8.0 notebook==6.5.4 notebook-shim==0.2.3 -numpy==1.23.5 +numpy==1.24.3 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.3.1 @@ -140,7 +140,7 @@ platformdirs==3.8.0 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 -prompt-toolkit==3.0.38 +prompt-toolkit==3.0.39 protobuf==4.23.3 psutil==5.9.5 ptyprocess==0.7.0 @@ -150,12 +150,11 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.2 pycparser==2.21 -pydantic==1.10.10 +pydantic==1.10.11 pydata-sphinx-theme==0.13.3 pygments==2.15.1 -pyparsing==3.1.0 -pyproject-api==1.5.2 -pyrsistent==0.19.3 +pyparsing==3.0.9 +pyproject-api==1.5.3 pytest==7.4.0 pytest-cov==4.1.0 pytest-xdist==3.3.1 @@ -165,11 +164,14 @@ python-json-logger==2.0.7 pyyaml==6.0 pyzmq==25.1.0 qrules==0.9.8 +referencing==0.29.1 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 +rpds-py==0.8.8 rsa==4.9 +ruff==0.0.277 scipy==1.11.1 send2trash==1.8.2 six==1.16.0 @@ -190,14 +192,14 @@ sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.17 +sqlalchemy==2.0.18 stack-data==0.6.2 sympy==1.12 tabulate==0.9.0 -tensorboard==2.12.3 +tensorboard==2.13.0 tensorboard-data-server==0.7.1 -tensorflow==2.12.0 -tensorflow-estimator==2.12.0 +tensorflow==2.13.0 +tensorflow-estimator==2.13.0 tensorflow-io-gcs-filesystem==0.32.0 tensorflow-probability==0.18.0 tensorwaves==0.4.10 @@ -206,10 +208,10 @@ terminado==0.17.1 tinycss2==1.2.1 tomli==2.0.1 tornado==6.3.2 -tox==4.6.3 +tox==4.6.4 tqdm==4.65.0 traitlets==5.9.0 -typing-extensions==4.7.1 +typing-extensions==4.5.0 uri-template==1.3.0 urllib3==1.26.16 virtualenv==20.23.1 @@ -219,8 +221,8 @@ webencodings==0.5.1 websocket-client==1.6.1 werkzeug==2.3.6 wheel==0.40.0 -widgetsnbextension==4.0.7 -wrapt==1.14.1 +widgetsnbextension==4.0.8 +wrapt==1.15.0 y-py==0.5.9 ypy-websocket==0.8.2 zipp==3.15.0 From ac6f11913873428f9d7b89cadbcda7ab621bade6 Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 6 Jul 2023 22:09:38 +0000 Subject: [PATCH 14/26] MAINT: update pip constraints and pre-commit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2f83ce42..ac3c0009 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.0.186 + rev: 0.0.187 hooks: - id: check-dev-files args: From 6bbf77bcf58a4d767815b97945910f3f52184043 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 6 Jul 2023 22:10:16 +0000 Subject: [PATCH 15/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .gitpod.yml | 1 + .vscode/extensions.json | 1 + .vscode/settings.json | 2 ++ 3 files changed, 4 insertions(+) diff --git a/.gitpod.yml b/.gitpod.yml index 1eca252d..3666b389 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -20,6 +20,7 @@ vscode: - garaioag.garaio-vscode-unwanted-recommendations - github.vscode-github-actions - github.vscode-pull-request-github + - ms-python.mypy-type-checker - ms-python.python - ms-python.vscode-pylance - ms-toolsai.vscode-jupyter-cell-tags diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 1d9df646..d901742d 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -7,6 +7,7 @@ "garaioag.garaio-vscode-unwanted-recommendations", "github.vscode-github-actions", "github.vscode-pull-request-github", + "ms-python.mypy-type-checker", "ms-python.python", "ms-python.vscode-pylance", "ms-toolsai.vscode-jupyter-cell-tags", diff --git a/.vscode/settings.json b/.vscode/settings.json index 53f9c876..d7a629a2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -33,12 +33,14 @@ "files.eol": "\n", "github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"], "livePreview.defaultPreviewPath": "docs/_build/html", + "mypy-type-checker.importStrategy": "fromEnvironment", "python.analysis.autoImportCompletions": false, "python.analysis.inlayHints.pytestParameters": true, "python.analysis.typeCheckingMode": "strict", "python.formatting.provider": "black", "python.linting.enabled": true, "python.linting.flake8Enabled": false, + "python.linting.mypyEnabled": false, "python.linting.pydocstyleEnabled": false, "python.linting.pylintEnabled": false, "python.testing.pytestArgs": ["--color=no"], From 75733ba9d5d7c85588200f75f6456c71376e7dd7 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 7 Jul 2023 00:24:59 +0200 Subject: [PATCH 16/26] FIX: remove mypy configuration --- .gitpod.yml | 1 - .pre-commit-config.yaml | 2 +- .vscode/extensions.json | 2 +- .vscode/settings.json | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 3666b389..1eca252d 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -20,7 +20,6 @@ vscode: - garaioag.garaio-vscode-unwanted-recommendations - github.vscode-github-actions - github.vscode-pull-request-github - - ms-python.mypy-type-checker - ms-python.python - ms-python.vscode-pylance - ms-toolsai.vscode-jupyter-cell-tags diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ac3c0009..2b3c2c43 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.0.187 + rev: 0.0.189 hooks: - id: check-dev-files args: diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d901742d..979ce482 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -7,7 +7,6 @@ "garaioag.garaio-vscode-unwanted-recommendations", "github.vscode-github-actions", "github.vscode-pull-request-github", - "ms-python.mypy-type-checker", "ms-python.python", "ms-python.vscode-pylance", "ms-toolsai.vscode-jupyter-cell-tags", @@ -25,6 +24,7 @@ "bungcip.better-toml", "ms-python.flake8", "ms-python.isort", + "ms-python.mypy-type-checker", "ms-python.pylint", "travisillig.vscode-json-stable-stringify" ] diff --git a/.vscode/settings.json b/.vscode/settings.json index d7a629a2..f1549816 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -33,7 +33,6 @@ "files.eol": "\n", "github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"], "livePreview.defaultPreviewPath": "docs/_build/html", - "mypy-type-checker.importStrategy": "fromEnvironment", "python.analysis.autoImportCompletions": false, "python.analysis.inlayHints.pytestParameters": true, "python.analysis.typeCheckingMode": "strict", From 9f6911f3a84a3ea62aedaf655bc2d3607e386eff Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 7 Jul 2023 00:48:30 +0200 Subject: [PATCH 17/26] MAINT: remove outdated flake option --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 64795b7b..1ef9a3ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,9 +69,6 @@ reportUnusedImport = true reportUnusedVariable = true typeCheckingMode = "strict" -[tool.nbqa.exclude] -flake8 = "^docs/appendix/benchmark.ipynb" - [tool.pytest.ini_options] addopts = [ "--color=yes", From 58127d6fa0563529c21c1b59cf75ae3dec16d11a Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 7 Jul 2023 00:49:56 +0200 Subject: [PATCH 18/26] MAINT: update notebook kernels --- docs/comparison/d2kkk.ipynb | 2 +- docs/comparison/jpsi2phipipi.ipynb | 2 +- docs/comparison/jpsi2pipipi.ipynb | 2 +- docs/jpsi2ksp.ipynb | 2 +- docs/lc2pkpi.ipynb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/comparison/d2kkk.ipynb b/docs/comparison/d2kkk.ipynb index c12e2ca3..e635024d 100644 --- a/docs/comparison/d2kkk.ipynb +++ b/docs/comparison/d2kkk.ipynb @@ -1034,7 +1034,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.16" + "version": "3.8.17" } }, "nbformat": 4, diff --git a/docs/comparison/jpsi2phipipi.ipynb b/docs/comparison/jpsi2phipipi.ipynb index 459ae95c..c8d16ef4 100644 --- a/docs/comparison/jpsi2phipipi.ipynb +++ b/docs/comparison/jpsi2phipipi.ipynb @@ -1019,7 +1019,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.16" + "version": "3.8.17" } }, "nbformat": 4, diff --git a/docs/comparison/jpsi2pipipi.ipynb b/docs/comparison/jpsi2pipipi.ipynb index 9a15747c..b8d133d6 100644 --- a/docs/comparison/jpsi2pipipi.ipynb +++ b/docs/comparison/jpsi2pipipi.ipynb @@ -1017,7 +1017,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.16" + "version": "3.8.17" } }, "nbformat": 4, diff --git a/docs/jpsi2ksp.ipynb b/docs/jpsi2ksp.ipynb index 620b819c..705223fd 100644 --- a/docs/jpsi2ksp.ipynb +++ b/docs/jpsi2ksp.ipynb @@ -970,7 +970,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.16" + "version": "3.8.17" } }, "nbformat": 4, diff --git a/docs/lc2pkpi.ipynb b/docs/lc2pkpi.ipynb index cee23f16..d5147f1e 100644 --- a/docs/lc2pkpi.ipynb +++ b/docs/lc2pkpi.ipynb @@ -373,7 +373,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.16" + "version": "3.8.17" } }, "nbformat": 4, From 9f82a7344fcf94e5279451347122e97222114d21 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 7 Jul 2023 00:57:56 +0200 Subject: [PATCH 19/26] DX: allow C408 error --- docs/comparison/d2kkk.ipynb | 6 +++--- docs/comparison/jpsi2phipipi.ipynb | 6 +++--- docs/comparison/jpsi2pipipi.ipynb | 6 +++--- docs/conf.py | 1 - pyproject.toml | 1 + src/ampform_dpd/io.py | 3 +-- tests/test_decay.py | 2 +- tests/test_io.py | 6 +++--- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/docs/comparison/d2kkk.ipynb b/docs/comparison/d2kkk.ipynb index e635024d..dcec4204 100644 --- a/docs/comparison/d2kkk.ipynb +++ b/docs/comparison/d2kkk.ipynb @@ -650,7 +650,7 @@ "source": [ "def create_sliders() -> dict[str, ToggleButtons]:\n", " all_parameters = dict(ampform_model.parameter_defaults.items())\n", - " all_parameters.update(dpd_model.parameter_defaults.items())\n", + " all_parameters.update(dpd_model.parameter_defaults)\n", " sliders = {}\n", " for symbol, value in all_parameters.items():\n", " value = \"+1\"\n", @@ -899,8 +899,8 @@ " )\n", "\n", " global lines\n", - " amp_kwargs = {\"color\": \"r\", \"label\": \"ampform\", \"linestyle\": \"solid\"}\n", - " dpd_kwargs = {\"color\": \"blue\", \"label\": \"dpd\", \"linestyle\": \"dotted\"}\n", + " amp_kwargs = dict(color=\"r\", label=\"ampform\", linestyle=\"solid\")\n", + " dpd_kwargs = dict(color=\"blue\", label=\"dpd\", linestyle=\"dotted\")\n", " if lines is None:\n", " sx = (s_edges[:-1] + s_edges[1:]) / 2\n", " tx = (t_edges[:-1] + t_edges[1:]) / 2\n", diff --git a/docs/comparison/jpsi2phipipi.ipynb b/docs/comparison/jpsi2phipipi.ipynb index c8d16ef4..869f28a4 100644 --- a/docs/comparison/jpsi2phipipi.ipynb +++ b/docs/comparison/jpsi2phipipi.ipynb @@ -633,7 +633,7 @@ "source": [ "def create_sliders() -> dict[str, ToggleButtons]:\n", " all_parameters = dict(ampform_model.parameter_defaults.items())\n", - " all_parameters.update(dpd_model.parameter_defaults.items())\n", + " all_parameters.update(dpd_model.parameter_defaults)\n", " sliders = {}\n", " for symbol, value in all_parameters.items():\n", " value = \"+1\"\n", @@ -883,8 +883,8 @@ " )\n", "\n", " global lines\n", - " amp_kwargs = {\"color\": \"r\", \"label\": \"ampform\", \"linestyle\": \"solid\"}\n", - " dpd_kwargs = {\"color\": \"blue\", \"label\": \"dpd\", \"linestyle\": \"dotted\"}\n", + " amp_kwargs = dict(color=\"r\", label=\"ampform\", linestyle=\"solid\")\n", + " dpd_kwargs = dict(color=\"blue\", label=\"dpd\", linestyle=\"dotted\")\n", " if lines is None:\n", " sx1 = (s1_edges[:-1] + s1_edges[1:]) / 2\n", " sx23 = (s23_edges[:-1] + s23_edges[1:]) / 2\n", diff --git a/docs/comparison/jpsi2pipipi.ipynb b/docs/comparison/jpsi2pipipi.ipynb index b8d133d6..92acc26d 100644 --- a/docs/comparison/jpsi2pipipi.ipynb +++ b/docs/comparison/jpsi2pipipi.ipynb @@ -633,7 +633,7 @@ "source": [ "def create_sliders() -> dict[str, ToggleButtons]:\n", " all_parameters = dict(ampform_model.parameter_defaults.items())\n", - " all_parameters.update(dict(dpd_model.parameter_defaults.items()))\n", + " all_parameters.update(dpd_model.parameter_defaults)\n", " sliders = {}\n", " for symbol, value in all_parameters.items():\n", " value = \"+1\"\n", @@ -882,8 +882,8 @@ " )\n", "\n", " global lines\n", - " amp_kwargs = {\"color\": \"r\", \"label\": \"ampform\", \"linestyle\": \"solid\"}\n", - " dpd_kwargs = {\"color\": \"blue\", \"label\": \"dpd\", \"linestyle\": \"dotted\"}\n", + " amp_kwargs = dict(color=\"r\", label=\"ampform\", linestyle=\"solid\")\n", + " dpd_kwargs = dict(color=\"blue\", label=\"dpd\", linestyle=\"dotted\")\n", " if lines is None:\n", " sx = (s_edges[:-1] + s_edges[1:]) / 2\n", " tx = (t_edges[:-1] + t_edges[1:]) / 2\n", diff --git a/docs/conf.py b/docs/conf.py index a533ac6b..05ec2219 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -43,7 +43,6 @@ def get_logo_path() -> str | None: url="https://raw.githubusercontent.com/ComPWA/ComPWA/04e5199/doc/images/logo.svg", output_path=path, ) - if os.path.exists(path): return path return None diff --git a/pyproject.toml b/pyproject.toml index 1ef9a3ff..5fd81195 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -130,6 +130,7 @@ extend-select = [ ] ignore = [ "B028", # missing explicit stacklevel keyword + "C408", "D101", "D102", "D103", diff --git a/src/ampform_dpd/io.py b/src/ampform_dpd/io.py index f0b38678..13593299 100644 --- a/src/ampform_dpd/io.py +++ b/src/ampform_dpd/io.py @@ -213,8 +213,7 @@ def _create_markdown_table_header(column_names: list[str]): def _create_markdown_table_row(items: Iterable): - items = (f"{i}" for i in items) - return "| " + " | ".join(items) + " |\n" + return "| " + " | ".join(f"{i}" for i in items) + " |\n" def perform_cached_doit( diff --git a/tests/test_decay.py b/tests/test_decay.py index 455bb0f0..68377963 100644 --- a/tests/test_decay.py +++ b/tests/test_decay.py @@ -1,7 +1,7 @@ from ampform_dpd.decay import IsobarNode, Particle # https://compwa-org--129.org.readthedocs.build/report/018.html#resonances-and-ls-scheme -dummy_args = {"mass": 0, "width": 0} +dummy_args = dict(mass=0, width=0) Λc = Particle("Λc", latex=R"\Lambda_c^+", spin=0.5, parity=+1, **dummy_args) p = Particle("p", latex="p", spin=0.5, parity=+1, **dummy_args) π = Particle("π+", latex=R"\pi^+", spin=0, parity=-1, **dummy_args) diff --git a/tests/test_io.py b/tests/test_io.py index ba832de7..f11760ae 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -53,9 +53,9 @@ def test_aslatex_isobar_node(): @pytest.mark.parametrize( ("assumptions", "expected_hash"), [ - ({}, "pythonhashseed-0+7459658071388516764"), - ({"real": True}, "pythonhashseed-0+3665410414623666716"), - ({"rational": True}, "pythonhashseed-0-7926839224244779605"), + (dict(), "pythonhashseed-0+7459658071388516764"), + (dict(real=True), "pythonhashseed-0+3665410414623666716"), + (dict(rational=True), "pythonhashseed-0-7926839224244779605"), ], ) def test_get_readable_hash(assumptions, expected_hash, caplog: LogCaptureFixture): From 3c350df722e9e59fabc3a85b72fc0f72d2b9dac3 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 7 Jul 2023 01:54:51 +0200 Subject: [PATCH 20/26] DX!: remove `aquirdturtle-collapsible-headings` --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 1c47fbb4..fca0d66d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -70,7 +70,6 @@ doc = tqdm jupyter = %(doc)s - aquirdturtle-collapsible-headings jupyterlab >=3.0 jupyterlab-code-formatter jupyterlab-myst From d348e2d2c71868e0af16d293ba4685c0bc247cf9 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 7 Jul 2023 01:59:37 +0200 Subject: [PATCH 21/26] MAINT: remove `ypy-websocket` restriction --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index fca0d66d..2e0e203a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -73,7 +73,6 @@ jupyter = jupyterlab >=3.0 jupyterlab-code-formatter jupyterlab-myst - ypy-websocket <0.8.3 # https://github.com/ComPWA/ampform-dpd/actions/runs/4350341987/jobs/7600958934#step:3:78 test = nbmake <=1.3.0 # https://github.com/ComPWA/ampform-dpd/actions/runs/3190469093/jobs/5205620578#step:3:69 numpy From 8740e2dc882952f51dc9fc4b5edfc5cd3dc369e3 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 7 Jul 2023 02:17:25 +0200 Subject: [PATCH 22/26] FIX: use correct `ypy-websocket` syntax --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index 2e0e203a..6d3f1c00 100644 --- a/setup.cfg +++ b/setup.cfg @@ -73,6 +73,7 @@ jupyter = jupyterlab >=3.0 jupyterlab-code-formatter jupyterlab-myst + ypy-websocket <0.8.3; python_version <"3.8.0" test = nbmake <=1.3.0 # https://github.com/ComPWA/ampform-dpd/actions/runs/3190469093/jobs/5205620578#step:3:69 numpy From 99c180701fb7d4b913258160bed808ac1bb28f6e Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 7 Jul 2023 00:20:54 +0000 Subject: [PATCH 23/26] MAINT: update pip constraints and pre-commit --- .constraints/py3.10.txt | 18 +++++------------- .constraints/py3.11.txt | 18 +++++------------- .constraints/py3.7.txt | 5 ++--- .constraints/py3.8.txt | 18 +++++------------- .constraints/py3.9.txt | 18 +++++------------- 5 files changed, 22 insertions(+), 55 deletions(-) diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt index 447fee1b..6566987d 100644 --- a/.constraints/py3.10.txt +++ b/.constraints/py3.10.txt @@ -6,17 +6,15 @@ # absl-py==1.4.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 -aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 asttokens==2.2.1 astunparse==1.6.3 +async-lru==2.0.2 attrs==23.1.0 babel==2.12.1 backcall==0.2.0 @@ -84,12 +82,10 @@ jupyter-cache==0.6.1 jupyter-client==8.3.0 jupyter-core==5.3.1 jupyter-events==0.6.3 +jupyter-lsp==2.2.0 jupyter-server==2.7.0 -jupyter-server-fileid==0.9.0 jupyter-server-terminals==0.4.4 -jupyter-server-ydoc==0.8.0 -jupyter-ydoc==0.2.4 -jupyterlab==3.6.5 +jupyterlab==4.0.2 jupyterlab-code-formatter==2.2.1 jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 @@ -113,14 +109,12 @@ 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.9.0 nbmake==1.3.0 nest-asyncio==1.5.6 nodeenv==1.8.0 -notebook==6.5.4 notebook-shim==0.2.3 numpy==1.24.3 oauthlib==3.2.2 @@ -135,12 +129,12 @@ pexpect==4.8.0 phasespace==1.8.0 pickleshare==0.7.5 pillow==10.0.0 -platformdirs==3.8.0 +platformdirs==3.8.1 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 prompt-toolkit==3.0.39 -protobuf==4.23.3 +protobuf==4.23.4 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 @@ -222,8 +216,6 @@ werkzeug==2.3.6 wheel==0.40.0 widgetsnbextension==4.0.8 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: diff --git a/.constraints/py3.11.txt b/.constraints/py3.11.txt index 2eae86f0..124b8a8c 100644 --- a/.constraints/py3.11.txt +++ b/.constraints/py3.11.txt @@ -6,17 +6,15 @@ # absl-py==1.4.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 -aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 asttokens==2.2.1 astunparse==1.6.3 +async-lru==2.0.2 attrs==23.1.0 babel==2.12.1 backcall==0.2.0 @@ -83,12 +81,10 @@ jupyter-cache==0.6.1 jupyter-client==8.3.0 jupyter-core==5.3.1 jupyter-events==0.6.3 +jupyter-lsp==2.2.0 jupyter-server==2.7.0 -jupyter-server-fileid==0.9.0 jupyter-server-terminals==0.4.4 -jupyter-server-ydoc==0.8.0 -jupyter-ydoc==0.2.4 -jupyterlab==3.6.5 +jupyterlab==4.0.2 jupyterlab-code-formatter==2.2.1 jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 @@ -112,14 +108,12 @@ 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.9.0 nbmake==1.3.0 nest-asyncio==1.5.6 nodeenv==1.8.0 -notebook==6.5.4 notebook-shim==0.2.3 numpy==1.24.3 oauthlib==3.2.2 @@ -134,12 +128,12 @@ pexpect==4.8.0 phasespace==1.8.0 pickleshare==0.7.5 pillow==10.0.0 -platformdirs==3.8.0 +platformdirs==3.8.1 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 prompt-toolkit==3.0.39 -protobuf==4.23.3 +protobuf==4.23.4 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 @@ -220,8 +214,6 @@ werkzeug==2.3.6 wheel==0.40.0 widgetsnbextension==4.0.8 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: diff --git a/.constraints/py3.7.txt b/.constraints/py3.7.txt index e6bb0be5..073f93ee 100644 --- a/.constraints/py3.7.txt +++ b/.constraints/py3.7.txt @@ -11,7 +11,6 @@ aiosqlite==0.19.0 alabaster==0.7.13 ampform==0.14.6 anyio==3.7.1 -aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 @@ -131,7 +130,7 @@ phasespace==1.8.0 pickleshare==0.7.5 pillow==9.5.0 pkgutil-resolve-name==1.3.10 -platformdirs==3.8.0 +platformdirs==3.8.1 pluggy==1.2.0 pre-commit==2.21.0 prometheus-client==0.17.0 @@ -220,7 +219,7 @@ wheel==0.40.0 widgetsnbextension==4.0.8 wrapt==1.15.0 y-py==0.5.9 -ypy-websocket==0.8.2 +ypy-websocket==0.8.2 ; python_version < "3.8.0" zipp==3.15.0 # The following packages are considered to be unsafe in a requirements file: diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index 10ab1b19..e0320c5c 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -6,17 +6,15 @@ # absl-py==1.4.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 -aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 asttokens==2.2.1 astunparse==1.6.3 +async-lru==2.0.2 attrs==23.1.0 babel==2.12.1 backcall==0.2.0 @@ -85,12 +83,10 @@ jupyter-cache==0.6.1 jupyter-client==8.3.0 jupyter-core==5.3.1 jupyter-events==0.6.3 +jupyter-lsp==2.2.0 jupyter-server==2.7.0 -jupyter-server-fileid==0.9.0 jupyter-server-terminals==0.4.4 -jupyter-server-ydoc==0.8.0 -jupyter-ydoc==0.2.4 -jupyterlab==3.6.5 +jupyterlab==4.0.2 jupyterlab-code-formatter==2.2.1 jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 @@ -114,14 +110,12 @@ 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.9.0 nbmake==1.3.0 nest-asyncio==1.5.6 nodeenv==1.8.0 -notebook==6.5.4 notebook-shim==0.2.3 numpy==1.24.3 oauthlib==3.2.2 @@ -137,12 +131,12 @@ phasespace==1.8.0 pickleshare==0.7.5 pillow==10.0.0 pkgutil-resolve-name==1.3.10 -platformdirs==3.8.0 +platformdirs==3.8.1 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 prompt-toolkit==3.0.39 -protobuf==4.23.3 +protobuf==4.23.4 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 @@ -225,8 +219,6 @@ werkzeug==2.3.6 wheel==0.40.0 widgetsnbextension==4.0.8 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: diff --git a/.constraints/py3.9.txt b/.constraints/py3.9.txt index 44671b69..39418f22 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -6,17 +6,15 @@ # absl-py==1.4.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 -aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 asttokens==2.2.1 astunparse==1.6.3 +async-lru==2.0.2 attrs==23.1.0 babel==2.12.1 backcall==0.2.0 @@ -85,12 +83,10 @@ jupyter-cache==0.6.1 jupyter-client==8.3.0 jupyter-core==5.3.1 jupyter-events==0.6.3 +jupyter-lsp==2.2.0 jupyter-server==2.7.0 -jupyter-server-fileid==0.9.0 jupyter-server-terminals==0.4.4 -jupyter-server-ydoc==0.8.0 -jupyter-ydoc==0.2.4 -jupyterlab==3.6.5 +jupyterlab==4.0.2 jupyterlab-code-formatter==2.2.1 jupyterlab-myst==2.0.1 jupyterlab-pygments==0.2.2 @@ -114,14 +110,12 @@ 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.9.0 nbmake==1.3.0 nest-asyncio==1.5.6 nodeenv==1.8.0 -notebook==6.5.4 notebook-shim==0.2.3 numpy==1.24.3 oauthlib==3.2.2 @@ -136,12 +130,12 @@ pexpect==4.8.0 phasespace==1.8.0 pickleshare==0.7.5 pillow==10.0.0 -platformdirs==3.8.0 +platformdirs==3.8.1 pluggy==1.2.0 pre-commit==3.3.3 prometheus-client==0.17.0 prompt-toolkit==3.0.39 -protobuf==4.23.3 +protobuf==4.23.4 psutil==5.9.5 ptyprocess==0.7.0 pure-eval==0.2.2 @@ -223,8 +217,6 @@ werkzeug==2.3.6 wheel==0.40.0 widgetsnbextension==4.0.8 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: From 08109951a77678225fb2cfd8ef45b0745a7d4de8 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 7 Jul 2023 02:22:08 +0200 Subject: [PATCH 24/26] MAINT: remove `nbmake` restrictions --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 6d3f1c00..848410eb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -75,7 +75,7 @@ jupyter = jupyterlab-myst ypy-websocket <0.8.3; python_version <"3.8.0" test = - nbmake <=1.3.0 # https://github.com/ComPWA/ampform-dpd/actions/runs/3190469093/jobs/5205620578#step:3:69 + nbmake numpy pytest >=6.0 # pyproject.toml pytest-cov From 4ddf64d51bfd39862cc1c8df840a43dee26d48f5 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 7 Jul 2023 02:51:14 +0200 Subject: [PATCH 25/26] MAINT: restrict `nbmake` only for Python 3.7 --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index 848410eb..8a48ebf6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -76,6 +76,7 @@ jupyter = ypy-websocket <0.8.3; python_version <"3.8.0" test = nbmake + nbmake <1.3; python_version <"3.8.0" numpy pytest >=6.0 # pyproject.toml pytest-cov From 05bb4a68bb612d3a6c33b808f78982cc48869fe0 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 7 Jul 2023 00:55:35 +0000 Subject: [PATCH 26/26] MAINT: update pip constraints and pre-commit --- .constraints/py3.10.txt | 4 ++-- .constraints/py3.11.txt | 4 ++-- .constraints/py3.7.txt | 2 +- .constraints/py3.8.txt | 4 ++-- .constraints/py3.9.txt | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt index 6566987d..c45f29a1 100644 --- a/.constraints/py3.10.txt +++ b/.constraints/py3.10.txt @@ -109,10 +109,10 @@ mpmath==1.3.0 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 -nbclient==0.5.13 +nbclient==0.6.8 nbconvert==7.6.0 nbformat==5.9.0 -nbmake==1.3.0 +nbmake==1.4.1 nest-asyncio==1.5.6 nodeenv==1.8.0 notebook-shim==0.2.3 diff --git a/.constraints/py3.11.txt b/.constraints/py3.11.txt index 124b8a8c..6fbcf73f 100644 --- a/.constraints/py3.11.txt +++ b/.constraints/py3.11.txt @@ -108,10 +108,10 @@ mpmath==1.3.0 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 -nbclient==0.5.13 +nbclient==0.6.8 nbconvert==7.6.0 nbformat==5.9.0 -nbmake==1.3.0 +nbmake==1.4.1 nest-asyncio==1.5.6 nodeenv==1.8.0 notebook-shim==0.2.3 diff --git a/.constraints/py3.7.txt b/.constraints/py3.7.txt index 073f93ee..635ef188 100644 --- a/.constraints/py3.7.txt +++ b/.constraints/py3.7.txt @@ -112,7 +112,7 @@ nbclassic==1.0.0 nbclient==0.5.13 nbconvert==7.6.0 nbformat==5.8.0 -nbmake==1.3.0 +nbmake==1.2.1 ; python_version < "3.8.0" nest-asyncio==1.5.6 nodeenv==1.8.0 notebook==6.5.4 diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index e0320c5c..0573be3c 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -110,10 +110,10 @@ mpmath==1.3.0 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 -nbclient==0.5.13 +nbclient==0.6.8 nbconvert==7.6.0 nbformat==5.9.0 -nbmake==1.3.0 +nbmake==1.4.1 nest-asyncio==1.5.6 nodeenv==1.8.0 notebook-shim==0.2.3 diff --git a/.constraints/py3.9.txt b/.constraints/py3.9.txt index 39418f22..592d9108 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -110,10 +110,10 @@ mpmath==1.3.0 mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 -nbclient==0.5.13 +nbclient==0.6.8 nbconvert==7.6.0 nbformat==5.9.0 -nbmake==1.3.0 +nbmake==1.4.1 nest-asyncio==1.5.6 nodeenv==1.8.0 notebook-shim==0.2.3