From 2fd5b20c8a7d3649ce1f4541f7d6e1299b9e150f Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Fri, 12 Jan 2024 18:58:36 +0100 Subject: [PATCH] MAINT: update pip constraints and pre-commit (#89) Co-authored-by: GitHub Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .constraints/py3.10.txt | 126 +++++++++---------- .constraints/py3.11.txt | 126 +++++++++---------- .constraints/py3.8.txt | 116 +++++++++--------- .constraints/py3.9.txt | 124 +++++++++---------- .cspell.json | 2 +- .github/workflows/requirements.yml | 1 - .gitpod.yml | 3 +- .pre-commit-config.yaml | 34 +++--- .vscode/extensions.json | 3 +- .vscode/settings.json | 3 +- docs/_relink_references.py | 83 ------------- docs/_templates/module.rst_t | 12 -- docs/_templates/package.rst_t | 49 -------- docs/_templates/toc.rst_t | 7 -- docs/_unsrt_et_al.py | 98 --------------- docs/conf.py | 188 ++++++++++++++--------------- docs/jpsi2ksp.ipynb | 55 ++++----- environment.yml | 4 +- pyproject.toml | 9 +- src/ampform_dpd/dynamics.py | 167 ++++++++++--------------- tests/test_io.py | 18 ++- tox.ini | 28 +++++ 22 files changed, 503 insertions(+), 753 deletions(-) delete mode 100644 docs/_relink_references.py delete mode 100644 docs/_templates/module.rst_t delete mode 100644 docs/_templates/package.rst_t delete mode 100644 docs/_templates/toc.rst_t delete mode 100644 docs/_unsrt_et_al.py diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt index 424fc5c6..05870954 100644 --- a/.constraints/py3.10.txt +++ b/.constraints/py3.10.txt @@ -6,19 +6,19 @@ # absl-py==2.0.0 accessible-pygments==0.0.4 -alabaster==0.7.13 -ampform==0.14.6 -anyio==4.1.0 +alabaster==0.7.16 +ampform==0.14.8 +anyio==4.2.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 asttokens==2.4.1 astunparse==1.6.3 async-lru==2.0.4 -attrs==23.1.0 -babel==2.13.1 +attrs==23.2.0 +babel==2.14.0 beautifulsoup4==4.12.2 -black==23.11.0 +black==23.12.1 bleach==6.1.0 cachetools==5.3.2 cattrs==23.2.3 @@ -30,66 +30,66 @@ charset-normalizer==3.3.2 click==8.1.7 cloudpickle==3.0.0 colorama==0.4.6 -comm==0.2.0 +comm==0.2.1 contourpy==1.2.0 -coverage==7.3.2 +coverage==7.4.0 cycler==0.12.1 debugpy==1.8.0 decorator==5.1.1 defusedxml==0.7.1 -distlib==0.3.7 +distlib==0.3.8 dm-tree==0.1.8 docstring-to-markdown==0.13 -docutils==0.19 +docutils==0.20.1 exceptiongroup==1.2.0 execnet==2.0.2 executing==2.0.1 -fastjsonschema==2.19.0 +fastjsonschema==2.19.1 filelock==3.13.1 flatbuffers==23.5.26 -fonttools==4.46.0 +fonttools==4.47.2 fqdn==1.5.1 gast==0.5.4 gitdb==4.0.11 -gitpython==3.1.40 -google-auth==2.24.0 -google-auth-oauthlib==1.1.0 +gitpython==3.1.41 +google-auth==2.26.2 +google-auth-oauthlib==1.2.0 google-pasta==0.2.0 graphviz==0.20.1 -greenlet==3.0.1 -grpcio==1.59.3 +greenlet==3.0.3 +grpcio==1.60.0 h5py==3.10.0 -hepunits==2.3.2 -identify==2.5.32 +hepunits==2.3.3 +identify==2.5.33 idna==3.6 imagesize==1.4.1 iminuit==2.24.0 -importlib-metadata==6.9.0 +importlib-metadata==7.0.1 iniconfig==2.0.0 -ipykernel==6.27.1 +ipykernel==6.28.0 ipympl==0.9.3 -ipython==8.18.1 +ipython==8.20.0 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 -isort==5.12.0 -jax==0.4.20 -jaxlib==0.4.20 +isort==5.13.2 +jax==0.4.23 +jaxlib==0.4.23 jedi==0.19.1 -jinja2==3.1.2 +jinja2==3.1.3 json5==0.9.14 jsonpointer==2.4 jsonschema==4.20.0 -jsonschema-specifications==2023.11.2 +jsonschema-specifications==2023.12.1 jupyter-cache==1.0.0 jupyter-client==8.6.0 -jupyter-core==5.5.0 +jupyter-core==5.7.1 jupyter-events==0.9.0 jupyter-lsp==2.2.1 -jupyter-server==2.11.1 +jupyter-server==2.12.4 jupyter-server-mathjax==0.2.6 -jupyter-server-terminals==0.4.4 -jupyterlab==4.0.9 +jupyter-server-terminals==0.5.1 +jupyterlab==4.0.10 jupyterlab-code-formatter==2.2.1 jupyterlab-git==0.50.0 jupyterlab-lsp==5.0.1 @@ -102,8 +102,8 @@ kiwisolver==1.4.5 latexcodec==2.0.1 libclang==16.0.6 livereload==2.6.3 -lsprotocol==2023.0.0 -markdown==3.5.1 +lsprotocol==2023.0.1 +markdown==3.5.2 markdown-it-py==3.0.0 markupsafe==2.1.3 matplotlib==3.8.2 @@ -117,14 +117,14 @@ mypy-extensions==1.0.0 myst-nb==1.0.0 myst-parser==2.0.0 nbclient==0.6.8 -nbconvert==7.11.0 +nbconvert==7.14.1 nbdime==4.0.1 nbformat==5.9.2 nbmake==1.4.6 nest-asyncio==1.5.8 nodeenv==1.8.0 notebook-shim==0.2.3 -numpy==1.26.2 +numpy==1.26.3 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.4.0 @@ -132,17 +132,17 @@ packaging==23.2 pandocfilters==1.5.0 parso==0.8.3 particle==0.23.1 -pathspec==0.11.2 +pathspec==0.12.1 pexpect==4.9.0 phasespace==1.9.0 -pillow==10.1.0 -platformdirs==4.0.0 +pillow==10.2.0 +platformdirs==4.1.0 pluggy==1.3.0 -pre-commit==3.5.0 +pre-commit==3.6.0 prometheus-client==0.19.0 -prompt-toolkit==3.0.41 +prompt-toolkit==3.0.43 protobuf==4.23.4 -psutil==5.9.6 +psutil==5.9.7 ptyprocess==0.7.0 pure-eval==0.2.2 pyasn1==0.5.1 @@ -150,32 +150,32 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.3 pycparser==2.21 -pydata-sphinx-theme==0.14.4 +pydata-sphinx-theme==0.15.1 pygments==2.17.2 pyparsing==3.1.1 pyproject-api==1.6.1 -pytest==7.4.3 +pytest==7.4.4 pytest-cov==4.1.0 pytest-xdist==3.5.0 python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 -python-lsp-ruff==2.0.0 +python-lsp-ruff==2.0.2 python-lsp-server==1.9.0 -pytoolconfig==1.2.6 +pytoolconfig==1.3.1 pyyaml==6.0.1 -pyzmq==25.1.1 +pyzmq==25.1.2 qrules==0.9.8 -referencing==0.31.1 +referencing==0.32.1 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rope==1.11.0 -rpds-py==0.13.2 +rpds-py==0.16.2 rsa==4.9 -ruff==0.1.6 +ruff==0.1.13 scipy==1.11.4 send2trash==1.8.2 six==1.16.0 @@ -183,29 +183,31 @@ smmap==5.0.1 sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.5 -sphinx==6.2.1 +sphinx==7.2.6 +sphinx-api-relink==0.0.8 sphinx-autobuild==2021.3.14 -sphinx-book-theme==1.0.1 +sphinx-book-theme==1.1.0 sphinx-codeautolink==0.15.0 sphinx-copybutton==0.5.2 sphinx-design==0.5.0 +sphinx-pybtex-etal-style==0.0.2 sphinx-togglebutton==0.3.2 sphinxcontrib-applehelp==1.0.7 -sphinxcontrib-bibtex==2.5.0 +sphinxcontrib-bibtex==2.6.2 sphinxcontrib-devhelp==1.0.5 sphinxcontrib-htmlhelp==2.0.4 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.6 sphinxcontrib-serializinghtml==1.1.9 -sqlalchemy==2.0.23 +sqlalchemy==2.0.25 stack-data==0.6.3 sympy==1.12 tabulate==0.9.0 tensorboard==2.15.1 tensorboard-data-server==0.7.2 -tensorflow==2.15.0 +tensorflow==2.15.0.post1 tensorflow-estimator==2.15.0 -tensorflow-io-gcs-filesystem==0.34.0 +tensorflow-io-gcs-filesystem==0.35.0 tensorflow-probability==0.23.0 tensorwaves==0.4.11 termcolor==2.4.0 @@ -213,19 +215,19 @@ terminado==0.18.0 tinycss2==1.2.1 tomli==2.0.1 tornado==6.4 -tox==4.11.4 +tox==4.12.0 tqdm==4.66.1 -traitlets==5.14.0 -types-python-dateutil==2.8.19.14 -typing-extensions==4.8.0 -ujson==5.8.0 +traitlets==5.14.1 +types-python-dateutil==2.8.19.20240106 +typing-extensions==4.9.0 +ujson==5.9.0 uri-template==1.3.0 urllib3==2.1.0 virtualenv==20.25.0 -wcwidth==0.2.12 +wcwidth==0.2.13 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.4 +websocket-client==1.7.0 werkzeug==3.0.1 wheel==0.42.0 widgetsnbextension==4.0.9 diff --git a/.constraints/py3.11.txt b/.constraints/py3.11.txt index 255d42b2..1c5a43f1 100644 --- a/.constraints/py3.11.txt +++ b/.constraints/py3.11.txt @@ -6,19 +6,19 @@ # absl-py==2.0.0 accessible-pygments==0.0.4 -alabaster==0.7.13 -ampform==0.14.6 -anyio==4.1.0 +alabaster==0.7.16 +ampform==0.14.8 +anyio==4.2.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 asttokens==2.4.1 astunparse==1.6.3 async-lru==2.0.4 -attrs==23.1.0 -babel==2.13.1 +attrs==23.2.0 +babel==2.14.0 beautifulsoup4==4.12.2 -black==23.11.0 +black==23.12.1 bleach==6.1.0 cachetools==5.3.2 cattrs==23.2.3 @@ -30,65 +30,65 @@ charset-normalizer==3.3.2 click==8.1.7 cloudpickle==3.0.0 colorama==0.4.6 -comm==0.2.0 +comm==0.2.1 contourpy==1.2.0 -coverage==7.3.2 +coverage==7.4.0 cycler==0.12.1 debugpy==1.8.0 decorator==5.1.1 defusedxml==0.7.1 -distlib==0.3.7 +distlib==0.3.8 dm-tree==0.1.8 docstring-to-markdown==0.13 -docutils==0.19 +docutils==0.20.1 execnet==2.0.2 executing==2.0.1 -fastjsonschema==2.19.0 +fastjsonschema==2.19.1 filelock==3.13.1 flatbuffers==23.5.26 -fonttools==4.46.0 +fonttools==4.47.2 fqdn==1.5.1 gast==0.5.4 gitdb==4.0.11 -gitpython==3.1.40 -google-auth==2.24.0 -google-auth-oauthlib==1.1.0 +gitpython==3.1.41 +google-auth==2.26.2 +google-auth-oauthlib==1.2.0 google-pasta==0.2.0 graphviz==0.20.1 -greenlet==3.0.1 -grpcio==1.59.3 +greenlet==3.0.3 +grpcio==1.60.0 h5py==3.10.0 -hepunits==2.3.2 -identify==2.5.32 +hepunits==2.3.3 +identify==2.5.33 idna==3.6 imagesize==1.4.1 iminuit==2.24.0 -importlib-metadata==6.9.0 +importlib-metadata==7.0.1 iniconfig==2.0.0 -ipykernel==6.27.1 +ipykernel==6.28.0 ipympl==0.9.3 -ipython==8.18.1 +ipython==8.20.0 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 -isort==5.12.0 -jax==0.4.20 -jaxlib==0.4.20 +isort==5.13.2 +jax==0.4.23 +jaxlib==0.4.23 jedi==0.19.1 -jinja2==3.1.2 +jinja2==3.1.3 json5==0.9.14 jsonpointer==2.4 jsonschema==4.20.0 -jsonschema-specifications==2023.11.2 +jsonschema-specifications==2023.12.1 jupyter-cache==1.0.0 jupyter-client==8.6.0 -jupyter-core==5.5.0 +jupyter-core==5.7.1 jupyter-events==0.9.0 jupyter-lsp==2.2.1 -jupyter-server==2.11.1 +jupyter-server==2.12.4 jupyter-server-mathjax==0.2.6 -jupyter-server-terminals==0.4.4 -jupyterlab==4.0.9 +jupyter-server-terminals==0.5.1 +jupyterlab==4.0.10 jupyterlab-code-formatter==2.2.1 jupyterlab-git==0.50.0 jupyterlab-lsp==5.0.1 @@ -101,8 +101,8 @@ kiwisolver==1.4.5 latexcodec==2.0.1 libclang==16.0.6 livereload==2.6.3 -lsprotocol==2023.0.0 -markdown==3.5.1 +lsprotocol==2023.0.1 +markdown==3.5.2 markdown-it-py==3.0.0 markupsafe==2.1.3 matplotlib==3.8.2 @@ -116,14 +116,14 @@ mypy-extensions==1.0.0 myst-nb==1.0.0 myst-parser==2.0.0 nbclient==0.6.8 -nbconvert==7.11.0 +nbconvert==7.14.1 nbdime==4.0.1 nbformat==5.9.2 nbmake==1.4.6 nest-asyncio==1.5.8 nodeenv==1.8.0 notebook-shim==0.2.3 -numpy==1.26.2 +numpy==1.26.3 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.4.0 @@ -131,17 +131,17 @@ packaging==23.2 pandocfilters==1.5.0 parso==0.8.3 particle==0.23.1 -pathspec==0.11.2 +pathspec==0.12.1 pexpect==4.9.0 phasespace==1.9.0 -pillow==10.1.0 -platformdirs==4.0.0 +pillow==10.2.0 +platformdirs==4.1.0 pluggy==1.3.0 -pre-commit==3.5.0 +pre-commit==3.6.0 prometheus-client==0.19.0 -prompt-toolkit==3.0.41 +prompt-toolkit==3.0.43 protobuf==4.23.4 -psutil==5.9.6 +psutil==5.9.7 ptyprocess==0.7.0 pure-eval==0.2.2 pyasn1==0.5.1 @@ -149,32 +149,32 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.3 pycparser==2.21 -pydata-sphinx-theme==0.14.4 +pydata-sphinx-theme==0.15.1 pygments==2.17.2 pyparsing==3.1.1 pyproject-api==1.6.1 -pytest==7.4.3 +pytest==7.4.4 pytest-cov==4.1.0 pytest-xdist==3.5.0 python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 -python-lsp-ruff==2.0.0 +python-lsp-ruff==2.0.2 python-lsp-server==1.9.0 -pytoolconfig==1.2.6 +pytoolconfig==1.3.1 pyyaml==6.0.1 -pyzmq==25.1.1 +pyzmq==25.1.2 qrules==0.9.8 -referencing==0.31.1 +referencing==0.32.1 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rope==1.11.0 -rpds-py==0.13.2 +rpds-py==0.16.2 rsa==4.9 -ruff==0.1.6 +ruff==0.1.13 scipy==1.11.4 send2trash==1.8.2 six==1.16.0 @@ -182,48 +182,50 @@ smmap==5.0.1 sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.5 -sphinx==6.2.1 +sphinx==7.2.6 +sphinx-api-relink==0.0.8 sphinx-autobuild==2021.3.14 -sphinx-book-theme==1.0.1 +sphinx-book-theme==1.1.0 sphinx-codeautolink==0.15.0 sphinx-copybutton==0.5.2 sphinx-design==0.5.0 +sphinx-pybtex-etal-style==0.0.2 sphinx-togglebutton==0.3.2 sphinxcontrib-applehelp==1.0.7 -sphinxcontrib-bibtex==2.5.0 +sphinxcontrib-bibtex==2.6.2 sphinxcontrib-devhelp==1.0.5 sphinxcontrib-htmlhelp==2.0.4 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.6 sphinxcontrib-serializinghtml==1.1.9 -sqlalchemy==2.0.23 +sqlalchemy==2.0.25 stack-data==0.6.3 sympy==1.12 tabulate==0.9.0 tensorboard==2.15.1 tensorboard-data-server==0.7.2 -tensorflow==2.15.0 +tensorflow==2.15.0.post1 tensorflow-estimator==2.15.0 -tensorflow-io-gcs-filesystem==0.34.0 +tensorflow-io-gcs-filesystem==0.35.0 tensorflow-probability==0.23.0 tensorwaves==0.4.11 termcolor==2.4.0 terminado==0.18.0 tinycss2==1.2.1 tornado==6.4 -tox==4.11.4 +tox==4.12.0 tqdm==4.66.1 -traitlets==5.14.0 -types-python-dateutil==2.8.19.14 -typing-extensions==4.8.0 -ujson==5.8.0 +traitlets==5.14.1 +types-python-dateutil==2.8.19.20240106 +typing-extensions==4.9.0 +ujson==5.9.0 uri-template==1.3.0 urllib3==2.1.0 virtualenv==20.25.0 -wcwidth==0.2.12 +wcwidth==0.2.13 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.4 +websocket-client==1.7.0 werkzeug==3.0.1 wheel==0.42.0 widgetsnbextension==4.0.9 diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index 8b32ee36..f9d60663 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -7,19 +7,19 @@ absl-py==2.0.0 accessible-pygments==0.0.4 alabaster==0.7.13 -ampform==0.14.6 -anyio==4.1.0 +ampform==0.14.8 +anyio==4.2.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 asttokens==2.4.1 astunparse==1.6.3 async-lru==2.0.4 -attrs==23.1.0 -babel==2.13.1 +attrs==23.2.0 +babel==2.14.0 backcall==0.2.0 beautifulsoup4==4.12.2 -black==23.11.0 +black==23.12.1 bleach==6.1.0 cachetools==5.3.2 cattrs==23.2.3 @@ -31,67 +31,67 @@ charset-normalizer==3.3.2 click==8.1.7 cloudpickle==3.0.0 colorama==0.4.6 -comm==0.2.0 +comm==0.2.1 contourpy==1.1.1 -coverage==7.3.2 +coverage==7.4.0 cycler==0.12.1 debugpy==1.8.0 decorator==5.1.1 defusedxml==0.7.1 -distlib==0.3.7 +distlib==0.3.8 dm-tree==0.1.8 docstring-to-markdown==0.13 docutils==0.17.1 exceptiongroup==1.2.0 execnet==2.0.2 executing==2.0.1 -fastjsonschema==2.19.0 +fastjsonschema==2.19.1 filelock==3.13.1 flatbuffers==23.5.26 -fonttools==4.46.0 +fonttools==4.47.2 fqdn==1.5.1 gast==0.4.0 gitdb==4.0.11 -gitpython==3.1.40 -google-auth==2.24.0 +gitpython==3.1.41 +google-auth==2.26.2 google-auth-oauthlib==1.0.0 google-pasta==0.2.0 graphviz==0.20.1 -greenlet==3.0.1 -grpcio==1.59.3 +greenlet==3.0.3 +grpcio==1.60.0 h5py==3.10.0 -hepunits==2.3.2 -identify==2.5.32 +hepunits==2.3.3 +identify==2.5.33 idna==3.6 imagesize==1.4.1 iminuit==2.24.0 -importlib-metadata==6.9.0 +importlib-metadata==7.0.1 importlib-resources==6.1.1 iniconfig==2.0.0 -ipykernel==6.27.1 +ipykernel==6.28.0 ipympl==0.9.3 ipython==8.12.3 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 -isort==5.12.0 +isort==5.13.2 jax==0.4.13 jaxlib==0.4.13 jedi==0.19.1 -jinja2==3.1.2 +jinja2==3.1.3 json5==0.9.14 jsonpointer==2.4 jsonschema==4.20.0 -jsonschema-specifications==2023.11.2 +jsonschema-specifications==2023.12.1 jupyter-cache==0.6.1 jupyter-client==8.6.0 -jupyter-core==5.5.0 +jupyter-core==5.7.1 jupyter-events==0.9.0 jupyter-lsp==2.2.1 -jupyter-server==2.11.1 +jupyter-server==2.12.4 jupyter-server-mathjax==0.2.6 -jupyter-server-terminals==0.4.4 -jupyterlab==4.0.9 +jupyter-server-terminals==0.5.1 +jupyterlab==4.0.10 jupyterlab-code-formatter==2.2.1 jupyterlab-git==0.50.0 jupyterlab-lsp==5.0.1 @@ -99,13 +99,13 @@ jupyterlab-myst==2.1.0 jupyterlab-pygments==0.3.0 jupyterlab-server==2.25.2 jupyterlab-widgets==3.0.9 -keras==2.13.1 +keras==2.12.0 kiwisolver==1.4.5 latexcodec==2.0.1 libclang==16.0.6 livereload==2.6.3 -lsprotocol==2023.0.0 -markdown==3.5.1 +lsprotocol==2023.0.1 +markdown==3.5.2 markdown-it-py==2.2.0 markupsafe==2.1.3 matplotlib==3.7.4 @@ -119,14 +119,14 @@ mypy-extensions==1.0.0 myst-nb==0.17.2 myst-parser==0.18.1 nbclient==0.6.8 -nbconvert==7.11.0 +nbconvert==7.14.1 nbdime==4.0.1 nbformat==5.9.2 nbmake==1.4.6 nest-asyncio==1.5.8 nodeenv==1.8.0 notebook-shim==0.2.3 -numpy==1.24.3 +numpy==1.23.5 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.4.0 @@ -134,19 +134,19 @@ packaging==23.2 pandocfilters==1.5.0 parso==0.8.3 particle==0.23.1 -pathspec==0.11.2 +pathspec==0.12.1 pexpect==4.9.0 phasespace==1.9.0 pickleshare==0.7.5 -pillow==10.1.0 +pillow==10.2.0 pkgutil-resolve-name==1.3.10 -platformdirs==4.0.0 +platformdirs==4.1.0 pluggy==1.3.0 pre-commit==3.5.0 prometheus-client==0.19.0 -prompt-toolkit==3.0.41 -protobuf==4.25.1 -psutil==5.9.6 +prompt-toolkit==3.0.43 +protobuf==4.25.2 +psutil==5.9.7 ptyprocess==0.7.0 pure-eval==0.2.2 pyasn1==0.5.1 @@ -158,29 +158,29 @@ pydata-sphinx-theme==0.14.4 pygments==2.17.2 pyparsing==3.1.1 pyproject-api==1.6.1 -pytest==7.4.3 +pytest==7.4.4 pytest-cov==4.1.0 pytest-xdist==3.5.0 python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 -python-lsp-ruff==2.0.0 +python-lsp-ruff==2.0.2 python-lsp-server==1.9.0 -pytoolconfig==1.2.6 +pytoolconfig==1.3.1 pytz==2023.3.post1 pyyaml==6.0.1 -pyzmq==25.1.1 +pyzmq==25.1.2 qrules==0.9.8 -referencing==0.31.1 +referencing==0.32.1 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rope==1.11.0 -rpds-py==0.13.2 +rpds-py==0.16.2 rsa==4.9 -ruff==0.1.6 +ruff==0.1.13 scipy==1.10.1 send2trash==1.8.2 six==1.16.0 @@ -189,52 +189,54 @@ sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.5 sphinx==5.3.0 +sphinx-api-relink==0.0.8 sphinx-autobuild==2021.3.14 sphinx-book-theme==1.0.1 sphinx-codeautolink==0.15.0 sphinx-copybutton==0.5.2 sphinx-design==0.5.0 +sphinx-pybtex-etal-style==0.0.2 sphinx-togglebutton==0.3.2 sphinxcontrib-applehelp==1.0.4 -sphinxcontrib-bibtex==2.6.1 +sphinxcontrib-bibtex==2.6.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 -sqlalchemy==2.0.23 +sqlalchemy==2.0.25 stack-data==0.6.3 sympy==1.12 tabulate==0.9.0 -tensorboard==2.13.0 +tensorboard==2.12.3 tensorboard-data-server==0.7.2 -tensorflow==2.13.1 -tensorflow-estimator==2.13.0 +tensorflow==2.12.0 +tensorflow-estimator==2.12.0 tensorflow-io-gcs-filesystem==0.34.0 -tensorflow-probability==0.21.0 +tensorflow-probability==0.20.1 tensorwaves==0.4.11 termcolor==2.4.0 terminado==0.18.0 tinycss2==1.2.1 tomli==2.0.1 tornado==6.4 -tox==4.11.4 +tox==4.12.0 tqdm==4.66.1 -traitlets==5.14.0 -types-python-dateutil==2.8.19.14 -typing-extensions==4.5.0 -ujson==5.8.0 +traitlets==5.14.1 +types-python-dateutil==2.8.19.20240106 +typing-extensions==4.9.0 +ujson==5.9.0 uri-template==1.3.0 urllib3==2.1.0 virtualenv==20.25.0 -wcwidth==0.2.12 +wcwidth==0.2.13 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.4 +websocket-client==1.7.0 werkzeug==3.0.1 wheel==0.42.0 widgetsnbextension==4.0.9 -wrapt==1.16.0 +wrapt==1.14.1 zipp==3.17.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 2ae89af7..6709092d 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -6,19 +6,19 @@ # absl-py==2.0.0 accessible-pygments==0.0.4 -alabaster==0.7.13 -ampform==0.14.6 -anyio==4.1.0 +alabaster==0.7.16 +ampform==0.14.8 +anyio==4.2.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 asttokens==2.4.1 astunparse==1.6.3 async-lru==2.0.4 -attrs==23.1.0 -babel==2.13.1 +attrs==23.2.0 +babel==2.14.0 beautifulsoup4==4.12.2 -black==23.11.0 +black==23.12.1 bleach==6.1.0 cachetools==5.3.2 cattrs==23.2.3 @@ -30,67 +30,67 @@ charset-normalizer==3.3.2 click==8.1.7 cloudpickle==3.0.0 colorama==0.4.6 -comm==0.2.0 +comm==0.2.1 contourpy==1.2.0 -coverage==7.3.2 +coverage==7.4.0 cycler==0.12.1 debugpy==1.8.0 decorator==5.1.1 defusedxml==0.7.1 -distlib==0.3.7 +distlib==0.3.8 dm-tree==0.1.8 docstring-to-markdown==0.13 -docutils==0.19 +docutils==0.20.1 exceptiongroup==1.2.0 execnet==2.0.2 executing==2.0.1 -fastjsonschema==2.19.0 +fastjsonschema==2.19.1 filelock==3.13.1 flatbuffers==23.5.26 -fonttools==4.46.0 +fonttools==4.47.2 fqdn==1.5.1 gast==0.5.4 gitdb==4.0.11 -gitpython==3.1.40 -google-auth==2.24.0 -google-auth-oauthlib==1.1.0 +gitpython==3.1.41 +google-auth==2.26.2 +google-auth-oauthlib==1.2.0 google-pasta==0.2.0 graphviz==0.20.1 -greenlet==3.0.1 -grpcio==1.59.3 +greenlet==3.0.3 +grpcio==1.60.0 h5py==3.10.0 -hepunits==2.3.2 -identify==2.5.32 +hepunits==2.3.3 +identify==2.5.33 idna==3.6 imagesize==1.4.1 iminuit==2.24.0 -importlib-metadata==6.9.0 +importlib-metadata==7.0.1 importlib-resources==6.1.1 iniconfig==2.0.0 -ipykernel==6.27.1 +ipykernel==6.28.0 ipympl==0.9.3 ipython==8.18.1 ipython-genutils==0.2.0 ipywidgets==8.1.1 isoduration==20.11.0 -isort==5.12.0 -jax==0.4.20 -jaxlib==0.4.20 +isort==5.13.2 +jax==0.4.23 +jaxlib==0.4.23 jedi==0.19.1 -jinja2==3.1.2 +jinja2==3.1.3 json5==0.9.14 jsonpointer==2.4 jsonschema==4.20.0 -jsonschema-specifications==2023.11.2 +jsonschema-specifications==2023.12.1 jupyter-cache==1.0.0 jupyter-client==8.6.0 -jupyter-core==5.5.0 +jupyter-core==5.7.1 jupyter-events==0.9.0 jupyter-lsp==2.2.1 -jupyter-server==2.11.1 +jupyter-server==2.12.4 jupyter-server-mathjax==0.2.6 -jupyter-server-terminals==0.4.4 -jupyterlab==4.0.9 +jupyter-server-terminals==0.5.1 +jupyterlab==4.0.10 jupyterlab-code-formatter==2.2.1 jupyterlab-git==0.50.0 jupyterlab-lsp==5.0.1 @@ -103,8 +103,8 @@ kiwisolver==1.4.5 latexcodec==2.0.1 libclang==16.0.6 livereload==2.6.3 -lsprotocol==2023.0.0 -markdown==3.5.1 +lsprotocol==2023.0.1 +markdown==3.5.2 markdown-it-py==3.0.0 markupsafe==2.1.3 matplotlib==3.8.2 @@ -118,14 +118,14 @@ mypy-extensions==1.0.0 myst-nb==1.0.0 myst-parser==2.0.0 nbclient==0.6.8 -nbconvert==7.11.0 +nbconvert==7.14.1 nbdime==4.0.1 nbformat==5.9.2 nbmake==1.4.6 nest-asyncio==1.5.8 nodeenv==1.8.0 notebook-shim==0.2.3 -numpy==1.26.2 +numpy==1.26.3 oauthlib==3.2.2 opt-einsum==3.3.0 overrides==7.4.0 @@ -133,17 +133,17 @@ packaging==23.2 pandocfilters==1.5.0 parso==0.8.3 particle==0.23.1 -pathspec==0.11.2 +pathspec==0.12.1 pexpect==4.9.0 phasespace==1.9.0 -pillow==10.1.0 -platformdirs==4.0.0 +pillow==10.2.0 +platformdirs==4.1.0 pluggy==1.3.0 -pre-commit==3.5.0 +pre-commit==3.6.0 prometheus-client==0.19.0 -prompt-toolkit==3.0.41 +prompt-toolkit==3.0.43 protobuf==4.23.4 -psutil==5.9.6 +psutil==5.9.7 ptyprocess==0.7.0 pure-eval==0.2.2 pyasn1==0.5.1 @@ -151,32 +151,32 @@ pyasn1-modules==0.3.0 pybtex==0.24.0 pybtex-docutils==1.0.3 pycparser==2.21 -pydata-sphinx-theme==0.14.4 +pydata-sphinx-theme==0.15.1 pygments==2.17.2 pyparsing==3.1.1 pyproject-api==1.6.1 -pytest==7.4.3 +pytest==7.4.4 pytest-cov==4.1.0 pytest-xdist==3.5.0 python-constraint==1.4.0 python-dateutil==2.8.2 python-json-logger==2.0.7 python-lsp-jsonrpc==1.1.2 -python-lsp-ruff==2.0.0 +python-lsp-ruff==2.0.2 python-lsp-server==1.9.0 -pytoolconfig==1.2.6 +pytoolconfig==1.3.1 pyyaml==6.0.1 -pyzmq==25.1.1 +pyzmq==25.1.2 qrules==0.9.8 -referencing==0.31.1 +referencing==0.32.1 requests==2.31.0 requests-oauthlib==1.3.1 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rope==1.11.0 -rpds-py==0.13.2 +rpds-py==0.16.2 rsa==4.9 -ruff==0.1.6 +ruff==0.1.13 scipy==1.11.4 send2trash==1.8.2 six==1.16.0 @@ -184,29 +184,31 @@ smmap==5.0.1 sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.5 -sphinx==6.2.1 +sphinx==7.2.6 +sphinx-api-relink==0.0.8 sphinx-autobuild==2021.3.14 -sphinx-book-theme==1.0.1 +sphinx-book-theme==1.1.0 sphinx-codeautolink==0.15.0 sphinx-copybutton==0.5.2 sphinx-design==0.5.0 +sphinx-pybtex-etal-style==0.0.2 sphinx-togglebutton==0.3.2 sphinxcontrib-applehelp==1.0.7 -sphinxcontrib-bibtex==2.5.0 +sphinxcontrib-bibtex==2.6.2 sphinxcontrib-devhelp==1.0.5 sphinxcontrib-htmlhelp==2.0.4 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.6 sphinxcontrib-serializinghtml==1.1.9 -sqlalchemy==2.0.23 +sqlalchemy==2.0.25 stack-data==0.6.3 sympy==1.12 tabulate==0.9.0 tensorboard==2.15.1 tensorboard-data-server==0.7.2 -tensorflow==2.15.0 +tensorflow==2.15.0.post1 tensorflow-estimator==2.15.0 -tensorflow-io-gcs-filesystem==0.34.0 +tensorflow-io-gcs-filesystem==0.35.0 tensorflow-probability==0.23.0 tensorwaves==0.4.11 termcolor==2.4.0 @@ -214,19 +216,19 @@ terminado==0.18.0 tinycss2==1.2.1 tomli==2.0.1 tornado==6.4 -tox==4.11.4 +tox==4.12.0 tqdm==4.66.1 -traitlets==5.14.0 -types-python-dateutil==2.8.19.14 -typing-extensions==4.8.0 -ujson==5.8.0 +traitlets==5.14.1 +types-python-dateutil==2.8.19.20240106 +typing-extensions==4.9.0 +ujson==5.9.0 uri-template==1.3.0 urllib3==2.1.0 virtualenv==20.25.0 -wcwidth==0.2.12 +wcwidth==0.2.13 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.4 +websocket-client==1.7.0 werkzeug==3.0.1 wheel==0.42.0 widgetsnbextension==4.0.9 diff --git a/.cspell.json b/.cspell.json index 4701468a..312e3693 100644 --- a/.cspell.json +++ b/.cspell.json @@ -24,7 +24,6 @@ ".vscode/*", ".vscode/.gitignore", "codecov.yml", - "docs/_templates/*", "docs/conf.py", "pyproject.toml", "tox.ini" @@ -97,6 +96,7 @@ "pycache", "pygments", "redeboer", + "repr", "savefig", "sdist", "seealso", diff --git a/.github/workflows/requirements.yml b/.github/workflows/requirements.yml index 7f62c35a..b2562f25 100644 --- a/.github/workflows/requirements.yml +++ b/.github/workflows/requirements.yml @@ -12,7 +12,6 @@ on: paths: - .constraints/py3.*.txt - .pre-commit-config.yaml - - setup.cfg schedule: - cron: "0 3 7 */2 *" workflow_dispatch: diff --git a/.gitpod.yml b/.gitpod.yml index 94274fb1..97ac67a3 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,5 @@ tasks: + - init: pyenv local 3.8 - init: pip install -c .constraints/py3.8.txt -e .[dev] github: @@ -18,7 +19,6 @@ vscode: - editorconfig.editorconfig - esbenp.prettier-vscode - executablebookproject.myst-highlight - - garaioag.garaio-vscode-unwanted-recommendations - github.vscode-github-actions - github.vscode-pull-request-github - ms-python.black-formatter @@ -29,6 +29,7 @@ vscode: - ms-vsliveshare.vsliveshare - oijaz.unicode-latex - redhat.vscode-yaml + - Soulcode.vscode-unwanted-extensions - stkb.rewrap - streetsidesoftware.code-spell-checker - tamasfe.even-better-toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c7d3c99b..98fa526d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,18 @@ repos: - id: check-hooks-apply - id: check-useless-excludes + - repo: https://github.com/ComPWA/policy + rev: 0.2.0 + hooks: + - id: check-dev-files + args: + - --doc-apt-packages=graphviz + - --no-prettierrc + - --pin-requirements=bimonthly + - --repo-name=ampform-dpd + - --repo-title=AmpForm-DPD + - id: colab-toc-visible + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: @@ -27,20 +39,8 @@ repos: - id: mixed-line-ending - id: trailing-whitespace - - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.1.6 - hooks: - - id: check-dev-files - args: - - --doc-apt-packages=graphviz - - --no-prettierrc - - --pin-requirements=bimonthly - - --repo-name=ampform-dpd - - --repo-title=AmpForm-DPD - - id: colab-toc-visible - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.11.0 + rev: 23.12.1 hooks: - id: black - id: black-jupyter @@ -48,7 +48,7 @@ repos: types_or: [jupyter] - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v8.0.0 + rev: v8.3.0 hooks: - id: cspell @@ -89,17 +89,17 @@ repos: metadata.vscode - repo: https://github.com/pre-commit/mirrors-prettier - rev: v4.0.0-alpha.3 + rev: v4.0.0-alpha.8 hooks: - id: prettier - repo: https://github.com/ComPWA/mirrors-pyright - rev: v1.1.338 + rev: v1.1.345 hooks: - id: pyright - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.6 + rev: v0.1.13 hooks: - id: ruff args: [--fix] diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 0d61abf4..4923a9a6 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,7 +5,6 @@ "editorconfig.editorconfig", "esbenp.prettier-vscode", "executablebookproject.myst-highlight", - "garaioag.garaio-vscode-unwanted-recommendations", "github.vscode-github-actions", "github.vscode-pull-request-github", "ms-python.black-formatter", @@ -16,6 +15,7 @@ "ms-vsliveshare.vsliveshare", "oijaz.unicode-latex", "redhat.vscode-yaml", + "Soulcode.vscode-unwanted-extensions", "stkb.rewrap", "streetsidesoftware.code-spell-checker", "tamasfe.even-better-toml", @@ -25,6 +25,7 @@ "unwantedRecommendations": [ "bungcip.better-toml", "davidanson.vscode-markdownlint", + "garaioag.garaio-vscode-unwanted-recommendations", "ms-python.flake8", "ms-python.isort", "ms-python.mypy-type-checker", diff --git a/.vscode/settings.json b/.vscode/settings.json index 714f0b93..caac3834 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -21,7 +21,7 @@ }, "[python]": { "editor.codeActionsOnSave": { - "source.organizeImports": true + "source.organizeImports": "explicit" }, "editor.defaultFormatter": "ms-python.black-formatter", "editor.rulers": [88] @@ -36,6 +36,7 @@ "files.eol": "\n", "github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"], "livePreview.defaultPreviewPath": "docs/_build/html", + "multiDiffEditor.experimental.enabled": true, "notebook.gotoSymbols.showAllSymbols": true, "python.analysis.autoImportCompletions": false, "python.analysis.inlayHints.pytestParameters": true, diff --git a/docs/_relink_references.py b/docs/_relink_references.py deleted file mode 100644 index 98fe0dc3..00000000 --- a/docs/_relink_references.py +++ /dev/null @@ -1,83 +0,0 @@ -# cspell:ignore refdomain refspecific reftarget reftype -"""Abbreviated the annotations generated by sphinx-autodoc. - -It's not necessary to generate the full path of type hints, because they are -rendered as clickable links. - -See also https://github.com/sphinx-doc/sphinx/issues/5868. -""" -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 - -if TYPE_CHECKING: - 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", - "sp.Symbol": "sympy.core.symbol.Symbol", - "sp.acos": "sympy.functions.elementary.trigonometric.acos", - "typing.Literal[-1, 1]": "typing.Literal", -} -__REF_TYPE_SUBSTITUTIONS = { - "ampform_dpd.decay.OuterStates": "obj", - "tensorwaves.interface.ParameterValue": "obj", -} - - -def _new_type_to_xref( - target: str, - env: BuildEnvironment | None = None, - suppress_prefix: bool = False, -) -> pending_xref: - reftype, target, title, refspecific = parse_reftarget(target, suppress_prefix) - target = __TARGET_SUBSTITUTIONS.get(target, target) - reftype = __REF_TYPE_SUBSTITUTIONS.get(target, reftype) - assert env is not None - return pending_xref( - "", - *__create_nodes(env, title), - refdomain="py", - reftype=reftype, - reftarget=target, - refspecific=refspecific, - **__get_env_kwargs(env), - ) - - -def __get_env_kwargs(env: BuildEnvironment) -> dict: - if env: - return { - "py:module": env.ref_context.get("py:module"), - "py:class": env.ref_context.get("py:class"), - } - return {} - - -def __create_nodes(env: BuildEnvironment, title: str) -> list[nodes.Node]: - short_name = title.split(".")[-1] - if env.config.python_use_unqualified_type_names: - return [ - pending_xref_condition("", short_name, condition="resolved"), - pending_xref_condition("", title, condition="*"), - ] - return [nodes.Text(short_name)] - - -def relink_references() -> None: - sphinx.domains.python.type_to_xref = _new_type_to_xref diff --git a/docs/_templates/module.rst_t b/docs/_templates/module.rst_t deleted file mode 100644 index ac37fd52..00000000 --- a/docs/_templates/module.rst_t +++ /dev/null @@ -1,12 +0,0 @@ -{%- if show_headings and not separate %} -{{ basename.split(".")[-1] | e | heading }} - -.. code-block:: python - - import {{ basename }} - -{% endif -%} -.. automodule:: {{ qualname }} -{%- for option in automodule_options %} - :{{ option }}: -{%- endfor %} diff --git a/docs/_templates/package.rst_t b/docs/_templates/package.rst_t deleted file mode 100644 index 97011393..00000000 --- a/docs/_templates/package.rst_t +++ /dev/null @@ -1,49 +0,0 @@ -{%- macro automodule(modname, options) -%} -.. automodule:: {{ modname }} -{%- for option in options %} - :{{ option }}: -{%- endfor %} -{%- endmacro %} - -{%- macro toctree(docnames) -%} -.. toctree:: -{% for docname in docnames %} - {{ docname }} -{%- endfor %} -{%- endmacro %} - -{{ pkgname.split(".")[-1] | e | heading }} - -.. code-block:: python - - import {{ pkgname }} - -{%- if modulefirst and not is_namespace %} -{{ automodule(pkgname, automodule_options) }} -{% endif %} - -{%- if not modulefirst and not is_namespace %} - -{{ automodule(pkgname, automodule_options) }} -{% endif %} - -{%- if submodules or subpackages %} -.. rubric:: Submodules and Subpackages -{% endif %} - -{%- if subpackages %} - -{{ toctree(subpackages) }} -{% endif %} -{%- if submodules %} -{% if separatemodules %} -{{ toctree(submodules) }} -{%- else %} -{%- for submodule in submodules %} -{% if show_headings %} -{{- [submodule, "module"] | join(" ") | e | heading(2) }} -{% endif %} -{{ automodule(submodule, automodule_options) }} -{% endfor %} -{%- endif %} -{% endif %} diff --git a/docs/_templates/toc.rst_t b/docs/_templates/toc.rst_t deleted file mode 100644 index 878540ce..00000000 --- a/docs/_templates/toc.rst_t +++ /dev/null @@ -1,7 +0,0 @@ -{{ header | heading }} - -.. toctree:: - :maxdepth: {{ maxdepth }} -{% for docname in docnames %} - {{ docname }} -{%- endfor %} diff --git a/docs/_unsrt_et_al.py b/docs/_unsrt_et_al.py deleted file mode 100644 index 6ccfce50..00000000 --- a/docs/_unsrt_et_al.py +++ /dev/null @@ -1,98 +0,0 @@ -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 ( - FieldIsMissing, - Node, - _format_list, # pyright: ignore[reportPrivateUsage] - field, - href, - join, - node, - sentence, - words, -) - - -class MyStyle(UnsrtStyle): # type: ignore[reportUntypedBaseClass] - def __init__(self) -> None: - super().__init__(abbreviate_names=True) - - 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] - return formatted_names - - def format_eprint(self, e: Entry) -> Node: - if "doi" in e.fields: - return "" - return super().format_eprint(e) - - def format_url(self, e: Entry) -> Node: - if "doi" in e.fields or "eprint" in e.fields: - return "" - return words[ - href[ - field("url", raw=True), - field("url", raw=True, apply_func=remove_http), - ] - ] - - def format_isbn(self, e: Entry) -> Node: - return href[ - join[ - "https://isbnsearch.org/isbn/", - field("isbn", raw=True, apply_func=remove_dashes_and_spaces), - ], - join[ - "ISBN:", - field("isbn", raw=True), - ], - ] - - -@node # pyright: ignore[reportUntypedFunctionDecorator] -def et_al(children, data, sep="", sep2=None, last_sep=None): - if sep2 is None: - sep2 = sep - if last_sep is None: - last_sep = sep - parts = [part for part in _format_list(children, data) if part] - if len(parts) <= 1: - return Text(*parts) - if len(parts) == 2: - return Text(sep2).join(parts) - if len(parts) == 3: - return Text(last_sep).join([Text(sep).join(parts[:-1]), parts[-1]]) - return Text(parts[0], Tag("em", " et al")) - - -@node # pyright: ignore[reportUntypedFunctionDecorator] -def names(children, context, role, **kwargs): - """Return formatted names.""" - assert not children - try: - persons = context["entry"].persons[role] - except KeyError: - raise FieldIsMissing(role, context["entry"]) from None - - style = context["style"] - formatted_names = [ - style.format_name(person, style.abbreviate_names) for person in persons - ] - return et_al(**kwargs)[formatted_names].format_data(context) - - -def remove_dashes_and_spaces(isbn: str) -> str: - to_remove = ["-", " "] - for remove in to_remove: - isbn = isbn.replace(remove, "") - return isbn - - -def remove_http(url: str) -> str: - to_remove = ["https://", "http://"] - for remove in to_remove: - url = url.replace(remove, "") - return url diff --git a/docs/conf.py b/docs/conf.py index 00f3a486..51f2c629 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,87 +1,56 @@ from __future__ import annotations -import contextlib -import os -import shutil -import subprocess -import sys -from importlib.metadata import PackageNotFoundError -from importlib.metadata import version as get_package_version - -import requests -from pybtex.plugin import register_plugin - -sys.path.insert(0, os.path.abspath(".")) - -from _relink_references import relink_references -from _unsrt_et_al import MyStyle +from sphinx_api_relink.helpers import ( + get_branch_name, + get_execution_mode, + get_package_version, + pin, + pin_minor, + set_intersphinx_version_remapping, +) + +set_intersphinx_version_remapping({ + "ipython": { + "8.12.2": "8.12.1", + "8.12.3": "8.12.1", + }, + "ipywidgets": { + "8.0.3": "8.0.5", + "8.0.4": "8.0.5", + "8.0.6": "8.0.5", + "8.1.1": "8.1.2", + }, + "mpl-interactions": {"0.24.1": "0.24.0"}, +}) -PACKAGE = "ampform-dpd" +BRANCH = get_branch_name() +ORGANIZATION = "ComPWA" +PACKAGE = "ampform_dpd" REPO_NAME = "ampform-dpd" -BRANCH = "main" - - -def get_execution_mode() -> str: - if "FORCE_EXECUTE_NB" in os.environ: - print("\033[93;1mWill run ALL Jupyter notebooks!\033[0m") - return "force" - if "EXECUTE_NB" in os.environ: - print("\033[93;1mWill run Jupyter notebooks with cache\033[0m") - return "cache" - return "off" - - -def get_logo_path() -> str | None: - path = "_static/logo.svg" - with contextlib.suppress(requests.exceptions.ConnectionError): - _fetch_logo( - url="https://raw.githubusercontent.com/ComPWA/ComPWA/04e5199/doc/images/logo.svg", - output_path=path, - ) - if os.path.exists(path): - return path - return None +REPO_TITLE = "Symbolic Dalitz-Plot Decomposition" - -def get_version() -> str: - try: - return get_package_version("ampform_dpd") - except PackageNotFoundError: - return "" - - -def _fetch_logo(url: str, output_path: str) -> None: - if os.path.exists(output_path): - return - online_content = requests.get(url, allow_redirects=True) - with open(output_path, "wb") as stream: - stream.write(online_content.content) - - -def generate_api() -> None: - shutil.rmtree("api", ignore_errors=True) - subprocess.call( - " ".join([ - "sphinx-apidoc", - "../src/ampform_dpd/", - "../src/ampform_dpd/version.py", - "-o api/", - "--force", - "--no-toc", - "--separate", - "--templatedir _templates", - ]), - shell=True, # noqa: S602 - ) - - -generate_api() -relink_references() -register_plugin("pybtex.style.formatting", "unsrt_et_al", MyStyle) +BINDER_LINK = f"https://mybinder.org/v2/gh/{ORGANIZATION}/{REPO_NAME}/{BRANCH}?filepath=docs/usage" +EXECUTE_NB = get_execution_mode() != "off" add_module_names = False -author = "Mikhail Mikhasenko, Remco de Boer" +api_github_repo = f"{ORGANIZATION}/{REPO_NAME}" +api_target_substitutions: dict[str, str | tuple[str, str]] = { + "Literal[(-1, 1)]": "typing.Literal", + "Literal[-1, 1]": "typing.Literal", + "OuterStates": ("obj", "ampform_dpd.decay.OuterStates"), + "ParameterValue": ("obj", "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", + "sp.Symbol": "sympy.core.symbol.Symbol", + "sp.acos": "sympy.functions.elementary.trigonometric.acos", +} +api_target_types: dict[str, str] = {} +author = "Common Partial Wave Analysis" autodoc_default_options = { "exclude-members": ", ".join([ "default_assumptions", @@ -99,11 +68,12 @@ def generate_api() -> None: autodoc_typehints_format = "short" autosectionlabel_prefix_document = True autosectionlabel_maxdepth = 2 -bibtex_bibfiles = [ - "references.bib", -] +bibtex_bibfiles = ["references.bib"] +bibtex_default_style = "unsrt_et_al" codeautolink_concat_default = True -copyright = "2022" # noqa: A001 +copybutton_prompt_is_regexp = True +copybutton_prompt_text = r">>> |\.\.\. " # doctest +copyright = f"2022, {ORGANIZATION}" # noqa: A001 default_role = "py:obj" exclude_patterns = [ "**.ipynb_checkpoints", @@ -114,20 +84,28 @@ def generate_api() -> None: extensions = [ "myst_nb", "sphinx.ext.autosectionlabel", + "sphinx.ext.doctest", "sphinx.ext.githubpages", "sphinx.ext.intersphinx", "sphinx.ext.napoleon", "sphinx.ext.viewcode", + "sphinx_api_relink", "sphinx_book_theme", "sphinx_codeautolink", "sphinx_copybutton", "sphinx_design", + "sphinx_pybtex_etal_style", "sphinx_togglebutton", "sphinxcontrib.bibtex", ] +generate_apidoc_package_path = f"../src/{PACKAGE}" html_favicon = "_static/favicon.ico" html_last_updated_fmt = "%-d %B %Y" -html_logo = get_logo_path() +html_logo = ( + "https://raw.githubusercontent.com/ComPWA/ComPWA/04e5199/doc/images/logo.svg" +) +html_show_copyright = False +html_show_sphinx = False html_sourcelink_suffix = "" html_theme = "sphinx_book_theme" html_theme_options = { @@ -140,7 +118,7 @@ def generate_api() -> None: }, { "name": "GitHub", - "url": f"https://github.com/ComPWA/{REPO_NAME}", + "url": f"https://github.com/{ORGANIZATION}/{REPO_NAME}", "icon": "fa-brands fa-github", }, { @@ -150,44 +128,53 @@ def generate_api() -> None: }, { "name": "Launch on Binder", - "url": ( - f"https://mybinder.org/v2/gh/ComPWA/{REPO_NAME}/{BRANCH}?filepath=docs" - ), + "url": f"https://mybinder.org/v2/gh/{ORGANIZATION}/{REPO_NAME}/{BRANCH}?filepath=docs", "icon": "https://mybinder.readthedocs.io/en/latest/_static/favicon.png", "type": "url", }, { "name": "Launch on Colaboratory", - "url": f"https://colab.research.google.com/github/ComPWA/{REPO_NAME}/blob/{BRANCH}", + "url": f"https://colab.research.google.com/github/{ORGANIZATION}/{REPO_NAME}/blob/{BRANCH}", "icon": "https://avatars.githubusercontent.com/u/33467679?s=100", "type": "url", }, ], "launch_buttons": { "binderhub_url": "https://mybinder.org", + "colab_url": "https://colab.research.google.com", + "deepnote_url": "https://deepnote.com", + "notebook_interface": "jupyterlab", }, - "logo": {"text": "Dalitz-Plot Decomposition"}, + "logo": {"text": REPO_TITLE}, "path_to_docs": "docs", - "repository_branch": "main", - "repository_url": "https://github.com/ComPWA/ampform-dpd", + "repository_branch": BRANCH, + "repository_url": f"https://github.com/{ORGANIZATION}/{REPO_NAME}", "show_navbar_depth": 2, "show_toc_level": 2, + "use_download_button": False, "use_edit_page_button": True, "use_issues_button": True, "use_repository_button": True, + "use_source_button": True, } -html_title = html_theme_options["logo"]["text"] +html_title = REPO_TITLE intersphinx_mapping = { - "IPython": ("https://ipython.readthedocs.io/en/stable", None), - "ampform": ("https://ampform.readthedocs.io/en/stable", None), - "attrs": ("https://www.attrs.org/en/stable", None), + "IPython": (f"https://ipython.readthedocs.io/en/{pin('IPython')}", None), + "ampform": (f"https://ampform.readthedocs.io/en/{pin('ampform')}", None), + "attrs": (f"https://www.attrs.org/en/{pin('attrs')}", None), "compwa-org": ("https://compwa-org.readthedocs.io", None), - "ipywidgets": ("https://ipywidgets.readthedocs.io/en/stable", None), + "graphviz": ("https://graphviz.readthedocs.io/en/stable", None), + "ipywidgets": (f"https://ipywidgets.readthedocs.io/en/{pin('ipywidgets')}", None), "jax": ("https://jax.readthedocs.io/en/latest", None), - "matplotlib": ("https://matplotlib.org/stable", None), + "matplotlib": (f"https://matplotlib.org/{pin('matplotlib')}", None), + "numpy": (f"https://numpy.org/doc/{pin_minor('numpy')}", None), "python": ("https://docs.python.org/3", None), + "qrules": (f"https://qrules.readthedocs.io/en/{pin('qrules')}", None), "sympy": ("https://docs.sympy.org/latest", None), - "tensorwaves": ("https://tensorwaves.readthedocs.io/en/stable", None), + "tensorwaves": ( + f"https://tensorwaves.readthedocs.io/en/{pin('tensorwaves')}", + None, + ), } linkcheck_anchors = False linkcheck_ignore = [ @@ -195,13 +182,16 @@ def generate_api() -> None: "https://journals.aps.org/prd/pdf/10.1103/PhysRevD.101.034033#page=9", ] myst_enable_extensions = [ + "amsmath", "colon_fence", "dollarmath", "html_image", + "smartquotes", "substitution", ] myst_heading_anchors = 3 myst_render_markdown_format = "myst" +myst_update_mathjax = False nb_execution_allow_errors = False nb_execution_mode = get_execution_mode() nb_execution_show_tb = True @@ -209,8 +199,8 @@ def generate_api() -> None: nb_output_stderr = "show" nb_render_markdown_format = "myst" nitpicky = True -numfig = True primary_domain = "py" +project = REPO_TITLE pygments_style = "sphinx" -version = get_version() -viewcode_follow_imported_members = True +release = get_package_version(PACKAGE) +version = get_package_version(PACKAGE) diff --git a/docs/jpsi2ksp.ipynb b/docs/jpsi2ksp.ipynb index 6a1c27c7..e56797c3 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 TYPE_CHECKING, Iterable\n", + "from typing import TYPE_CHECKING, Any, Iterable\n", "\n", "import jax.numpy as jnp\n", "import matplotlib.pyplot as plt\n", @@ -37,13 +37,7 @@ "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 perform_cached_doit, unevaluated\n", "from IPython.display import Latex, Markdown\n", "from tensorwaves.data.transform import SympyDataTransformer\n", "from tqdm.auto import tqdm\n", @@ -279,13 +273,18 @@ }, "outputs": [], "source": [ - "@make_commutative\n", - "@implement_doit_method\n", - "class RelativisticBreitWigner(UnevaluatedExpression):\n", - " def __new__(cls, s, mass0, gamma0, m1, m2, angular_momentum, meson_radius):\n", - " return create_expression(\n", - " cls, s, mass0, gamma0, m1, m2, angular_momentum, meson_radius\n", - " )\n", + "@unevaluated\n", + "class RelativisticBreitWigner(sp.Expr):\n", + " s: Any\n", + " mass0: Any\n", + " gamma0: Any\n", + " m1: Any\n", + " m2: Any\n", + " angular_momentum: Any\n", + " meson_radius: Any\n", + " _latex_repr_ = (\n", + " R\"\\mathcal{{R}}_{{{angular_momentum}}}\\left({s}, {mass0}, {gamma0}\\right)\"\n", + " )\n", "\n", " def evaluate(self):\n", " s, m0, w0, m1, m2, angular_momentum, meson_radius = self.args\n", @@ -301,10 +300,6 @@ " )\n", " return (m0 * w0) / (m0**2 - s - width * m0 * sp.I)\n", "\n", - " def _latex(self, printer, *args) -> str:\n", - " s, m0, w0, _, _, L, *_ = map(printer._print, self.args)\n", - " return Rf\"\\mathcal{{R}}_{{{L}}}\\left({s}, {m0}, {w0}\\right)\"\n", - "\n", "\n", "bw = RelativisticBreitWigner(*sp.symbols(\"s m0 Gamma0 m1 m2 L R\"))\n", "Latex(aslatex({bw: bw.doit(deep=False)}))" @@ -330,11 +325,17 @@ }, "outputs": [], "source": [ - "@make_commutative\n", - "@implement_doit_method\n", - "class FormFactor(UnevaluatedExpression):\n", - " def __new__(cls, s, m1, m2, angular_momentum, meson_radius):\n", - " return create_expression(cls, s, m1, m2, angular_momentum, meson_radius)\n", + "@unevaluated\n", + "class FormFactor(sp.Expr):\n", + " s: Any\n", + " m1: Any\n", + " m2: Any\n", + " angular_momentum: Any\n", + " meson_radius: Any\n", + "\n", + " _latex_repr_ = (\n", + " R\"\\mathcal{{F}}_{{{angular_momentum}}}\\left({s}, {m1}, {m1}\\right)\"\n", + " )\n", "\n", " def evaluate(self):\n", " s, m1, m2, angular_momentum, meson_radius = self.args\n", @@ -346,10 +347,6 @@ " meson_radius=meson_radius,\n", " )\n", "\n", - " def _latex(self, printer, *args) -> str:\n", - " s, m1, m2, L, *_ = map(printer._print, self.args)\n", - " return Rf\"\\mathcal{{F}}_{{{L}}}\\left({s}, {m1}, {m1}\\right)\"\n", - "\n", "\n", "ff = FormFactor(*sp.symbols(\"s m1 m2 L R\"))\n", "Latex(aslatex({ff: ff.doit(deep=False)}))" @@ -973,7 +970,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.17" + "version": "3.8.18" } }, "nbformat": 4, diff --git a/environment.yml b/environment.yml index 51a3ec55..17c7d794 100644 --- a/environment.yml +++ b/environment.yml @@ -6,9 +6,7 @@ dependencies: - python==3.8.* - pip - pip: - - | - -c .constraints/py3.8.txt - -e .[dev] + - -c .constraints/py3.8.txt -e .[dev] variables: PRETTIER_LEGACY_CLI: "1" PYTHONHASHSEED: 0 diff --git a/pyproject.toml b/pyproject.toml index 33878777..6f509d65 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "ampform ~=0.14.4", # Kibble and Kallen functions, perform_cached_doit + "ampform >=0.14.8", # Kibble and Kallen functions, perform_cached_doit, @unevaluated "attrs >=20.1.0", # on_setattr and https://www.attrs.org/en/stable/api.html#next-gen "cloudpickle", "sympy >=1.10", # module sympy.printing.numpy and array expressions with shape kwarg @@ -52,10 +52,12 @@ doc = [ "ipywidgets", "matplotlib", "myst-nb >=0.14", # nb_render_markdown_format for Markdown tables + "sphinx-api-relink >=0.0.4", "sphinx-book-theme", "sphinx-codeautolink[ipython]", "sphinx-copybutton", "sphinx-design", + "sphinx-pybtex-etal-style", "sphinx-togglebutton", "sphinxcontrib-bibtex", "tensorwaves[phsp]", @@ -93,6 +95,7 @@ sty = [ "pre-commit >=1.4.0", "pybtex", "sphinx", + "sphinx-api-relink >=0.0.4", ] tensorflow = [ "ampform-dpd[tf]", @@ -291,7 +294,7 @@ ignore-names = [ "PLW0603", "PLW2901", "S101", - "T201", + "T20", "TCH00", ] "docs/*" = [ @@ -302,6 +305,7 @@ ignore-names = [ "S113", "T201", ] +"docs/conf.py" = ["D100"] "setup.py" = ["D100"] "tests/*" = [ "D", @@ -310,6 +314,7 @@ ignore-names = [ "PLR0913", "PLR2004", "S101", + "T20", ] [tool.ruff.pydocstyle] diff --git a/src/ampform_dpd/dynamics.py b/src/ampform_dpd/dynamics.py index c2d4c7bf..3c824bce 100644 --- a/src/ampform_dpd/dynamics.py +++ b/src/ampform_dpd/dynamics.py @@ -1,79 +1,52 @@ """Functions for dynamics lineshapes and kinematics.""" -# pyright: reportPrivateUsage=false from __future__ import annotations +from typing import Any + 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 unevaluated -@make_commutative -@implement_doit_method -class P(UnevaluatedExpression): - def __new__(cls, s, mi, mj, **hints): - return create_expression(cls, s, mi, mj, **hints) +@unevaluated +class P(sp.Expr): + s: Any + mi: Any + mj: Any + _latex_repr_ = R"p_{{{mi},{mj}}}\left({s}\right)" def evaluate(self): s, mi, mj = self.args return sp.sqrt(Kallen(s, mi**2, mj**2)) / (2 * sp.sqrt(s)) - def _latex(self, printer, *args): - s, mi, mj = map(printer._print, self.args) - return Rf"p_{{{mi},{mj}}}\left({s}\right)" - -@make_commutative -@implement_doit_method -class Q(UnevaluatedExpression): - def __new__(cls, s, m0, mk, **hints): - return create_expression(cls, s, m0, mk, **hints) +@unevaluated +class Q(sp.Expr): + s: Any + m0: Any + mk: Any + _latex_repr_ = R"q_{{{m0},{mk}}}\left({s}\right)" def evaluate(self): s, m0, mk = self.args return sp.sqrt(Kallen(s, m0**2, mk**2)) / (2 * m0) # <-- not s! - def _latex(self, printer, *args): - s, m0, mk = map(printer._print, self.args) - return Rf"q_{{{m0},{mk}}}\left({s}\right)" - - -@make_commutative -@implement_doit_method -class BreitWignerMinL(UnevaluatedExpression): - def __new__( - cls, - s, - decaying_mass, - spectator_mass, - resonance_mass, - resonance_width, - child2_mass, - child1_mass, - l_dec, - l_prod, - R_dec, - R_prod, - ): - return create_expression( - cls, - s, - decaying_mass, - spectator_mass, - resonance_mass, - resonance_width, - child2_mass, - child1_mass, - l_dec, - l_prod, - R_dec, - R_prod, - ) + +@unevaluated +class BreitWignerMinL(sp.Expr): + s: Any + decaying_mass: Any + spectator_mass: Any + resonance_mass: Any + resonance_width: Any + child2_mass: Any + child1_mass: Any + l_dec: Any + l_prod: Any + R_dec: Any + R_prod: Any + _latex_repr_ = R"\mathcal{{R}}^\mathrm{{BW}}_{{{l_dec},{l_prod}}}\left({s}\right)" def evaluate(self): s, m_top, m_spec, m0, Γ0, m1, m2, l_dec, l_prod, R_dec, R_prod = self.args @@ -91,18 +64,16 @@ def evaluate(self): evaluate=False, ) - def _latex(self, printer, *args) -> str: - s = printer._print(self.args[0]) - l_dec = printer._print(self.args[7]) - l_prod = printer._print(self.args[8]) - return Rf"\mathcal{{R}}^\mathrm{{BW}}_{{{l_dec},{l_prod}}}\left({s}\right)" - -@make_commutative -@implement_doit_method -class BuggBreitWigner(UnevaluatedExpression): - def __new__(cls, s, m0, Γ0, m1, m2, γ): - return create_expression(cls, s, m0, Γ0, m1, m2, γ) +@unevaluated +class BuggBreitWigner(sp.Expr): + s: Any + m0: Any + Γ0: Any + m1: Any + m2: Any + γ: Any + _latex_repr_ = R"\mathcal{{R}}^\mathrm{{Bugg}}\left({s}\right)" def evaluate(self): s, m0, Γ0, m1, m2, γ = self.args @@ -114,17 +85,16 @@ def evaluate(self): ) return 1 / (m0**2 - s - sp.I * g_squared) - def _latex(self, printer, *args) -> str: - s = printer._print(self.args[0], *args) - return Rf"\mathcal{{R}}^\mathrm{{Bugg}}\left({s}\right)" - -@make_commutative -@implement_doit_method -class FlattéSWave(UnevaluatedExpression): +@unevaluated +class FlattéSWave(sp.Expr): # https://github.com/ComPWA/polarimetry/blob/34f5330/julia/notebooks/model0.jl#L151-L161 - def __new__(cls, s, m0, widths, masses1, masses2): - return create_expression(cls, s, m0, widths, masses1, masses2) + s: Any + m0: Any + widths: tuple[Any, Any] + masses1: tuple[Any, Any] + masses2: tuple[Any, Any] + _latex_repr_ = R"\mathcal{{R}}^\mathrm{{Flatté}}\left({s}\right)" def evaluate(self): s, m0, (Γ1, Γ2), (ma1, mb1), (ma2, mb2) = self.args @@ -137,16 +107,17 @@ def evaluate(self): Γ = Γ1 + Γ2 return 1 / (m0**2 - s - sp.I * m0 * Γ) - def _latex(self, printer, *args) -> str: - s = printer._print(self.args[0]) - return Rf"\mathcal{{R}}^\mathrm{{Flatté}}\left({s}\right)" - -@make_commutative -@implement_doit_method -class EnergyDependentWidth(UnevaluatedExpression): - def __new__(cls, s, m0, Γ0, m1, m2, L, R): - return create_expression(cls, s, m0, Γ0, m1, m2, L, R) +@unevaluated +class EnergyDependentWidth(sp.Expr): + s: Any + m0: Any + Γ0: Any + m1: Any + m2: Any + L: Any + R: Any + _latex_repr_ = R"\Gamma\left({s}\right)" def evaluate(self): s, m0, Γ0, m1, m2, L, R = self.args @@ -162,16 +133,12 @@ def evaluate(self): evaluate=False, ) - def _latex(self, printer, *args) -> str: - s = printer._print(self.args[0]) - return Rf"\Gamma\left({s}\right)" - -@make_commutative -@implement_doit_method -class BlattWeisskopf(UnevaluatedExpression): - def __new__(cls, z, L, **hints): - return create_expression(cls, z, L, **hints) +@unevaluated +class BlattWeisskopf(sp.Expr): + z: Any + L: Any + _latex_repr_ = R"F_{{{L}}}\left({z}\right)" def evaluate(self) -> sp.Piecewise: z, L = self.args @@ -180,10 +147,6 @@ def evaluate(self) -> sp.Piecewise: 1: 1 / (1 + z**2), 2: 1 / (9 + 3 * z**2 + z**4), } - return sp.Piecewise(*[ - (sp.sqrt(expr), sp.Eq(L, l_val)) for l_val, expr in cases.items() - ]) - - def _latex(self, printer, *args): - z, L = map(printer._print, self.args) - return Rf"F_{{{L}}}\left({z}\right)" + return sp.Piecewise( + *[(sp.sqrt(expr), sp.Eq(L, l_val)) for l_val, expr in cases.items()] + ) diff --git a/tests/test_io.py b/tests/test_io.py index f11760ae..e15e1209 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -3,6 +3,7 @@ import logging import os +import sys from os.path import abspath, dirname from typing import TYPE_CHECKING @@ -53,12 +54,14 @@ 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"), + (dict(), (+7459658071388516764, +8778804591879682108)), + (dict(real=True), (+3665410414623666716, -7967572625470457155)), + (dict(rational=True), (-7926839224244779605, -8321323707982755013)), ], ) -def test_get_readable_hash(assumptions, expected_hash, caplog: LogCaptureFixture): +def test_get_readable_hash( + assumptions, expected_hash: tuple[int, int], caplog: LogCaptureFixture +): caplog.set_level(logging.WARNING) x, y = sp.symbols("x y", **assumptions) expr = x**2 + y @@ -70,7 +73,12 @@ def test_get_readable_hash(assumptions, expected_hash, caplog: LogCaptureFixture assert "PYTHONHASHSEED has not been set." in caplog.text caplog.clear() elif python_hash_seed == "0": - assert h == expected_hash + if sys.version_info < (3, 11): + expected_hash = expected_hash[0] + else: + expected_hash = expected_hash[1] + expected = f"pythonhashseed-0{expected_hash:+d}" + assert h == expected else: pytest.skip("PYTHONHASHSEED has been set, but is not 0") assert caplog.text == "" diff --git a/tox.ini b/tox.ini index 5c83f8df..bc687031 100644 --- a/tox.ini +++ b/tox.ini @@ -82,6 +82,34 @@ setenv = FORCE_COLOR = yes PYTHONHASHSEED = 0 +[testenv:docnblive] +allowlist_externals = + sphinx-autobuild +commands = + sphinx-autobuild \ + --open-browser \ + --re-ignore .*/.ipynb_checkpoints/.* \ + --re-ignore .*/__pycache__/.* \ + --re-ignore .*\.pkl \ + --re-ignore .*\.pdf \ + --re-ignore .*\.png \ + --re-ignore .*\.svg \ + --re-ignore .*\.tmp \ + --re-ignore docs/_build/.* \ + --re-ignore docs/_images/.* \ + --re-ignore docs/api/.* \ + --re-ignore docs/export/.* \ + --watch docs \ + --watch src \ + docs/ docs/_build/html +description = + Set up a server to directly preview changes to the HTML pages +passenv = * +setenv = + EXECUTE_NB = yes + FORCE_COLOR = yes + PYTHONHASHSEED = 0 + [testenv:docnb-force] allowlist_externals = sphinx-build