From 281bd67180ca6d909ae6422493c417743e7190bb Mon Sep 17 00:00:00 2001 From: Remco de Boer Date: Thu, 2 Dec 2021 16:28:20 +0100 Subject: [PATCH] ci: test notebooks with nbmake (#186) * ci: run mypy in tox sty job through pre-commit This is possible since #184 made mypy run serial in pre-commit * ci: rename tox testnb job to nb * ci: switch to nbmake * ci: update workflows with repo-maintenance * ci: update pip constraints and pre-commit config * chore: use next-gen attr API Since attr >20.1.0 is already requested, we can switch to https://www.attrs.org/en/stable/api.html#next-gen * ci: update pip constraints and pre-commit config Co-authored-by: GitHub --- .constraints/py3.10.txt | 23 ++++++------ .constraints/py3.6.txt | 18 +++++----- .constraints/py3.7.txt | 22 ++++++------ .constraints/py3.8.txt | 22 ++++++------ .constraints/py3.9.txt | 23 ++++++------ .cspell.json | 3 ++ .github/workflows/cd.yml | 21 +++++++---- .github/workflows/ci-docs.yml | 10 +++--- .github/workflows/requirements-pr.yml | 51 ++++++++++++++++----------- .pre-commit-config.yaml | 4 +-- pytest.ini | 7 ++-- setup.cfg | 4 +-- src/ampform/dynamics/builder.py | 2 +- src/ampform/helicity/__init__.py | 2 +- src/ampform/helicity/decay.py | 4 +-- tox.ini | 8 ++--- 16 files changed, 125 insertions(+), 99 deletions(-) diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt index fc4f21e70..3e5256b1c 100644 --- a/.constraints/py3.10.txt +++ b/.constraints/py3.10.txt @@ -9,7 +9,7 @@ anyio==3.4.0 aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.1.0 astroid==2.9.0 -attrs==20.3.0 +attrs==21.2.0 babel==2.9.1 backcall==0.2.0 backports.entry-points-selectable==1.1.1 @@ -36,7 +36,7 @@ execnet==1.9.0 filelock==3.4.0 flake8==4.0.1 flake8-blind-except==0.2.0 -flake8-bugbear==21.11.28 +flake8-bugbear==21.11.29 flake8-builtins==1.5.3 flake8-comprehensions==3.7.0 flake8-plugin-utils==1.3.2 @@ -57,9 +57,8 @@ identify==2.4.0 idna==3.3 imagesize==1.3.0 importlib-metadata==4.8.2 -importlib-resources==5.4.0 iniconfig==1.1.1 -ipykernel==6.5.1 +ipykernel==6.6.0 ipympl==0.8.2 ipython==7.30.0 ipython-genutils==0.2.0 @@ -77,6 +76,7 @@ jupyter-server-mathjax==0.2.3 jupyter-sphinx==0.3.2 jupyterlab==3.2.4 jupyterlab-code-formatter==1.4.10 +jupyterlab-pygments==0.1.2 jupyterlab-server==2.8.2 jupyterlab-widgets==1.0.2 kiwisolver==1.3.2 @@ -99,16 +99,17 @@ myst-nb==0.13.1 myst-parser==0.15.2 nbclassic==0.3.4 nbclient==0.5.9 -nbconvert==5.6.1 +nbconvert==6.3.0 nbdime==3.1.1 nbformat==5.1.3 -nest-asyncio==1.5.1 +nbmake==1.0 +nest-asyncio==1.5.4 nodeenv==1.6.0 notebook==6.4.6 numpy==1.21.4 packaging==21.3 pandocfilters==1.5.0 -parso==0.8.2 +parso==0.8.3 particle==0.16.2 pathspec==0.9.0 pep517==0.12.0 @@ -119,7 +120,7 @@ pillow==8.4.0 pip-tools==6.4.0 platformdirs==2.4.0 pluggy==1.0.0 -pre-commit==2.15.0 +pre-commit==2.16.0 prometheus-client==0.12.0 prompt-toolkit==3.0.23 ptyprocess==0.7.0 @@ -128,6 +129,7 @@ pybtex==0.24.0 pybtex-docutils==1.0.1 pycodestyle==2.8.0 pycparser==2.21 +pydantic==1.8.2 pydata-sphinx-theme==0.7.2 pydocstyle==6.1.1 pyflakes==2.4.0 @@ -138,7 +140,6 @@ pyrsistent==0.18.0 pytest==6.2.5 pytest-cov==3.0.0 pytest-forked==1.3.0 -pytest-notebook==0.6.1 pytest-profiling==1.7.0 pytest-xdist==2.4.0 python-constraint==1.4.0 @@ -151,7 +152,7 @@ radon==5.1.0 regex==2021.11.10 requests==2.26.0 restructuredtext-lint==1.3.2 -rich==10.15.0 +rich==10.15.2 send2trash==1.8.0 setuptools-scm==6.3.2 six==1.16.0 @@ -188,7 +189,7 @@ types-docutils==0.17.1 types-pkg-resources==0.1.3 types-requests==2.26.1 types-setuptools==57.4.4 -typing-extensions==4.0.0 +typing-extensions==4.0.1 urllib3==1.26.7 virtualenv==20.10.0 wcwidth==0.2.5 diff --git a/.constraints/py3.6.txt b/.constraints/py3.6.txt index 12d6518f2..87207a353 100644 --- a/.constraints/py3.6.txt +++ b/.constraints/py3.6.txt @@ -10,7 +10,7 @@ aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.1.0 astroid==2.9.0 async-generator==1.10 -attrs==20.3.0 +attrs==21.2.0 babel==2.9.1 backcall==0.2.0 backports.entry-points-selectable==1.1.1 @@ -38,7 +38,7 @@ execnet==1.9.0 filelock==3.4.0 flake8==4.0.1 flake8-blind-except==0.2.0 -flake8-bugbear==21.11.28 +flake8-bugbear==21.11.29 flake8-builtins==1.5.3 flake8-comprehensions==3.7.0 flake8-plugin-utils==1.3.2 @@ -78,6 +78,7 @@ jupyter-server-mathjax==0.2.3 jupyter-sphinx==0.3.2 jupyterlab==3.2.4 jupyterlab-code-formatter==1.4.10 +jupyterlab-pygments==0.1.2 jupyterlab-server==2.8.2 jupyterlab-widgets==1.0.2 kiwisolver==1.3.1 @@ -99,10 +100,11 @@ myst-nb==0.13.1 myst-parser==0.15.2 nbclassic==0.3.4 nbclient==0.5.9 -nbconvert==5.6.1 +nbconvert==6.0.7 nbdime==3.1.1 nbformat==5.1.3 -nest-asyncio==1.5.1 +nbmake==1.0 +nest-asyncio==1.5.4 nodeenv==1.6.0 notebook==6.4.6 numpy==1.19.5 @@ -119,7 +121,7 @@ pillow==8.4.0 pip-tools==6.4.0 platformdirs==2.4.0 pluggy==1.0.0 -pre-commit==2.15.0 +pre-commit==2.16.0 prometheus-client==0.12.0 prompt-toolkit==3.0.23 ptyprocess==0.7.0 @@ -128,6 +130,7 @@ pybtex==0.24.0 pybtex-docutils==1.0.1 pycodestyle==2.8.0 pycparser==2.21 +pydantic==1.8.2 pydata-sphinx-theme==0.7.2 pydocstyle==6.1.1 pyflakes==2.4.0 @@ -138,7 +141,6 @@ pyrsistent==0.18.0 pytest==6.2.5 pytest-cov==3.0.0 pytest-forked==1.3.0 -pytest-notebook==0.6.1 pytest-profiling==1.7.0 pytest-xdist==2.4.0 python-constraint==1.4.0 @@ -151,7 +153,7 @@ radon==5.1.0 regex==2021.11.10 requests==2.26.0 restructuredtext-lint==1.3.2 -rich==10.15.0 +rich==10.15.2 send2trash==1.8.0 six==1.16.0 smmap==5.0.0 @@ -188,7 +190,7 @@ types-docutils==0.17.1 types-pkg-resources==0.1.3 types-requests==2.26.1 types-setuptools==57.4.4 -typing-extensions==4.0.0 ; python_version < "3.8.0" +typing-extensions==4.0.1 ; python_version < "3.8.0" urllib3==1.26.7 virtualenv==20.10.0 wcwidth==0.2.5 diff --git a/.constraints/py3.7.txt b/.constraints/py3.7.txt index 2c49b6470..0ab4c78b9 100644 --- a/.constraints/py3.7.txt +++ b/.constraints/py3.7.txt @@ -10,7 +10,7 @@ aquirdturtle-collapsible-headings==3.1.0 argcomplete==1.12.3 argon2-cffi==21.1.0 astroid==2.9.0 -attrs==20.3.0 +attrs==21.2.0 babel==2.9.1 backcall==0.2.0 backports.entry-points-selectable==1.1.1 @@ -37,7 +37,7 @@ execnet==1.9.0 filelock==3.4.0 flake8==4.0.1 flake8-blind-except==0.2.0 -flake8-bugbear==21.11.28 +flake8-bugbear==21.11.29 flake8-builtins==1.5.3 flake8-comprehensions==3.7.0 flake8-plugin-utils==1.3.2 @@ -59,7 +59,7 @@ imagesize==1.3.0 importlib-metadata==4.2.0 importlib-resources==5.4.0 iniconfig==1.1.1 -ipykernel==6.5.1 +ipykernel==6.6.0 ipympl==0.8.2 ipython==7.30.0 ipython-genutils==0.2.0 @@ -77,6 +77,7 @@ jupyter-server-mathjax==0.2.3 jupyter-sphinx==0.3.2 jupyterlab==3.2.4 jupyterlab-code-formatter==1.4.10 +jupyterlab-pygments==0.1.2 jupyterlab-server==2.8.2 jupyterlab-widgets==1.0.2 kiwisolver==1.3.2 @@ -99,16 +100,17 @@ myst-nb==0.13.1 myst-parser==0.15.2 nbclassic==0.3.4 nbclient==0.5.9 -nbconvert==5.6.1 +nbconvert==6.3.0 nbdime==3.1.1 nbformat==5.1.3 -nest-asyncio==1.5.1 +nbmake==1.0 +nest-asyncio==1.5.4 nodeenv==1.6.0 notebook==6.4.6 numpy==1.21.4 packaging==21.3 pandocfilters==1.5.0 -parso==0.8.2 +parso==0.8.3 particle==0.16.2 pathspec==0.9.0 pep517==0.12.0 @@ -119,7 +121,7 @@ pillow==8.4.0 pip-tools==6.4.0 platformdirs==2.4.0 pluggy==1.0.0 -pre-commit==2.15.0 +pre-commit==2.16.0 prometheus-client==0.12.0 prompt-toolkit==3.0.23 ptyprocess==0.7.0 @@ -128,6 +130,7 @@ pybtex==0.24.0 pybtex-docutils==1.0.1 pycodestyle==2.8.0 pycparser==2.21 +pydantic==1.8.2 pydata-sphinx-theme==0.7.2 pydocstyle==6.1.1 pyflakes==2.4.0 @@ -138,7 +141,6 @@ pyrsistent==0.18.0 pytest==6.2.5 pytest-cov==3.0.0 pytest-forked==1.3.0 -pytest-notebook==0.6.1 pytest-profiling==1.7.0 pytest-xdist==2.4.0 python-constraint==1.4.0 @@ -151,7 +153,7 @@ radon==5.1.0 regex==2021.11.10 requests==2.26.0 restructuredtext-lint==1.3.2 -rich==10.15.0 +rich==10.15.2 send2trash==1.8.0 setuptools-scm==6.3.2 six==1.16.0 @@ -189,7 +191,7 @@ types-docutils==0.17.1 types-pkg-resources==0.1.3 types-requests==2.26.1 types-setuptools==57.4.4 -typing-extensions==4.0.0 ; python_version < "3.8.0" +typing-extensions==4.0.1 ; python_version < "3.8.0" urllib3==1.26.7 virtualenv==20.10.0 wcwidth==0.2.5 diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index 7a143ccbb..fb1c81f44 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -9,7 +9,7 @@ anyio==3.4.0 aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.1.0 astroid==2.9.0 -attrs==20.3.0 +attrs==21.2.0 babel==2.9.1 backcall==0.2.0 backports.entry-points-selectable==1.1.1 @@ -36,7 +36,7 @@ execnet==1.9.0 filelock==3.4.0 flake8==4.0.1 flake8-blind-except==0.2.0 -flake8-bugbear==21.11.28 +flake8-bugbear==21.11.29 flake8-builtins==1.5.3 flake8-comprehensions==3.7.0 flake8-plugin-utils==1.3.2 @@ -59,7 +59,7 @@ imagesize==1.3.0 importlib-metadata==4.8.2 importlib-resources==5.4.0 iniconfig==1.1.1 -ipykernel==6.5.1 +ipykernel==6.6.0 ipympl==0.8.2 ipython==7.30.0 ipython-genutils==0.2.0 @@ -77,6 +77,7 @@ jupyter-server-mathjax==0.2.3 jupyter-sphinx==0.3.2 jupyterlab==3.2.4 jupyterlab-code-formatter==1.4.10 +jupyterlab-pygments==0.1.2 jupyterlab-server==2.8.2 jupyterlab-widgets==1.0.2 kiwisolver==1.3.2 @@ -99,16 +100,17 @@ myst-nb==0.13.1 myst-parser==0.15.2 nbclassic==0.3.4 nbclient==0.5.9 -nbconvert==5.6.1 +nbconvert==6.3.0 nbdime==3.1.1 nbformat==5.1.3 -nest-asyncio==1.5.1 +nbmake==1.0 +nest-asyncio==1.5.4 nodeenv==1.6.0 notebook==6.4.6 numpy==1.21.4 packaging==21.3 pandocfilters==1.5.0 -parso==0.8.2 +parso==0.8.3 particle==0.16.2 pathspec==0.9.0 pep517==0.12.0 @@ -119,7 +121,7 @@ pillow==8.4.0 pip-tools==6.4.0 platformdirs==2.4.0 pluggy==1.0.0 -pre-commit==2.15.0 +pre-commit==2.16.0 prometheus-client==0.12.0 prompt-toolkit==3.0.23 ptyprocess==0.7.0 @@ -128,6 +130,7 @@ pybtex==0.24.0 pybtex-docutils==1.0.1 pycodestyle==2.8.0 pycparser==2.21 +pydantic==1.8.2 pydata-sphinx-theme==0.7.2 pydocstyle==6.1.1 pyflakes==2.4.0 @@ -138,7 +141,6 @@ pyrsistent==0.18.0 pytest==6.2.5 pytest-cov==3.0.0 pytest-forked==1.3.0 -pytest-notebook==0.6.1 pytest-profiling==1.7.0 pytest-xdist==2.4.0 python-constraint==1.4.0 @@ -151,7 +153,7 @@ radon==5.1.0 regex==2021.11.10 requests==2.26.0 restructuredtext-lint==1.3.2 -rich==10.15.0 +rich==10.15.2 send2trash==1.8.0 setuptools-scm==6.3.2 six==1.16.0 @@ -188,7 +190,7 @@ types-docutils==0.17.1 types-pkg-resources==0.1.3 types-requests==2.26.1 types-setuptools==57.4.4 -typing-extensions==4.0.0 +typing-extensions==4.0.1 urllib3==1.26.7 virtualenv==20.10.0 wcwidth==0.2.5 diff --git a/.constraints/py3.9.txt b/.constraints/py3.9.txt index e98f011cd..2d2c87f2a 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -9,7 +9,7 @@ anyio==3.4.0 aquirdturtle-collapsible-headings==3.1.0 argon2-cffi==21.1.0 astroid==2.9.0 -attrs==20.3.0 +attrs==21.2.0 babel==2.9.1 backcall==0.2.0 backports.entry-points-selectable==1.1.1 @@ -36,7 +36,7 @@ execnet==1.9.0 filelock==3.4.0 flake8==4.0.1 flake8-blind-except==0.2.0 -flake8-bugbear==21.11.28 +flake8-bugbear==21.11.29 flake8-builtins==1.5.3 flake8-comprehensions==3.7.0 flake8-plugin-utils==1.3.2 @@ -57,9 +57,8 @@ identify==2.4.0 idna==3.3 imagesize==1.3.0 importlib-metadata==4.8.2 -importlib-resources==5.4.0 iniconfig==1.1.1 -ipykernel==6.5.1 +ipykernel==6.6.0 ipympl==0.8.2 ipython==7.30.0 ipython-genutils==0.2.0 @@ -77,6 +76,7 @@ jupyter-server-mathjax==0.2.3 jupyter-sphinx==0.3.2 jupyterlab==3.2.4 jupyterlab-code-formatter==1.4.10 +jupyterlab-pygments==0.1.2 jupyterlab-server==2.8.2 jupyterlab-widgets==1.0.2 kiwisolver==1.3.2 @@ -99,16 +99,17 @@ myst-nb==0.13.1 myst-parser==0.15.2 nbclassic==0.3.4 nbclient==0.5.9 -nbconvert==5.6.1 +nbconvert==6.3.0 nbdime==3.1.1 nbformat==5.1.3 -nest-asyncio==1.5.1 +nbmake==1.0 +nest-asyncio==1.5.4 nodeenv==1.6.0 notebook==6.4.6 numpy==1.21.4 packaging==21.3 pandocfilters==1.5.0 -parso==0.8.2 +parso==0.8.3 particle==0.16.2 pathspec==0.9.0 pep517==0.12.0 @@ -119,7 +120,7 @@ pillow==8.4.0 pip-tools==6.4.0 platformdirs==2.4.0 pluggy==1.0.0 -pre-commit==2.15.0 +pre-commit==2.16.0 prometheus-client==0.12.0 prompt-toolkit==3.0.23 ptyprocess==0.7.0 @@ -128,6 +129,7 @@ pybtex==0.24.0 pybtex-docutils==1.0.1 pycodestyle==2.8.0 pycparser==2.21 +pydantic==1.8.2 pydata-sphinx-theme==0.7.2 pydocstyle==6.1.1 pyflakes==2.4.0 @@ -138,7 +140,6 @@ pyrsistent==0.18.0 pytest==6.2.5 pytest-cov==3.0.0 pytest-forked==1.3.0 -pytest-notebook==0.6.1 pytest-profiling==1.7.0 pytest-xdist==2.4.0 python-constraint==1.4.0 @@ -151,7 +152,7 @@ radon==5.1.0 regex==2021.11.10 requests==2.26.0 restructuredtext-lint==1.3.2 -rich==10.15.0 +rich==10.15.2 send2trash==1.8.0 setuptools-scm==6.3.2 six==1.16.0 @@ -188,7 +189,7 @@ types-docutils==0.17.1 types-pkg-resources==0.1.3 types-requests==2.26.1 types-setuptools==57.4.4 -typing-extensions==4.0.0 +typing-extensions==4.0.1 urllib3==1.26.7 virtualenv==20.10.0 wcwidth==0.2.5 diff --git a/.cspell.json b/.cspell.json index 0b60c0abd..ba1464d73 100644 --- a/.cspell.json +++ b/.cspell.json @@ -128,6 +128,7 @@ "Autoupdate", "axhline", "axvline", + "bdist", "boldsymbol", "cahn", "cano", @@ -222,6 +223,7 @@ "precommit", "prefactor", "preorder", + "prereleased", "pygments", "pylance", "pylintrc", @@ -235,6 +237,7 @@ "risch", "rtfd", "savefig", + "sdist", "seealso", "sharex", "sharey", diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b0864a5fe..543384227 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,5 +1,3 @@ -# cspell:ignore bdist noreply prereleased sdist - name: CD on: @@ -10,16 +8,27 @@ on: jobs: push: - name: Push to stable branch + name: Push to version branches if: startsWith(github.ref, 'refs/tags') runs-on: ubuntu-20.04 steps: - uses: actions/checkout@master - - name: Push to stable branch + - name: Configure Git credentials run: | git config --global user.name "GitHub Action" git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git push origin HEAD:refs/heads/stable -f + - name: Push to stable branch + run: | + git push origin HEAD:refs/heads/stable + - name: Push to matching minor version branch + env: + TAG: ${{ github.ref_name }} + run: | + re='^([0-9]+)\.([0-9]+)\.[0-9]+' + if [[ $TAG =~ $re ]]; then + MINOR_VERSION_BRANCH="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.x" + git push origin HEAD:refs/heads/$MINOR_VERSION_BRANCH + fi pypi: name: Publish to PyPI @@ -31,7 +40,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: "3.8" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml index 7a3910ffa..3bb3f085c 100644 --- a/.github/workflows/ci-docs.yml +++ b/.github/workflows/ci-docs.yml @@ -31,11 +31,6 @@ jobs: EXECUTE_NB: YES GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: make html - - uses: actions/upload-artifact@v2 - if: ${{ always() }} - with: - name: html - path: docs/_build/html - name: Print error logs with color if: ${{ failure() }} # cspell:ignore printf @@ -48,3 +43,8 @@ jobs: echo cat "$log_file" done + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: html + path: docs/_build/html diff --git a/.github/workflows/requirements-pr.yml b/.github/workflows/requirements-pr.yml index f2bd3092d..83900bd36 100644 --- a/.github/workflows/requirements-pr.yml +++ b/.github/workflows/requirements-pr.yml @@ -7,8 +7,30 @@ on: - epic/* jobs: + diff: + name: Check dependency changes + if: github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Determine dependency changes + run: | + DIFF="$(git diff origin/main --color -- .constraints .pre-commit-config.yaml setup.cfg)" + echo ::set-output name=diff::"${DIFF}" + id: diff + outputs: + diff: ${{ steps.diff.outputs.diff }} + pip-constraints: - name: Update pip constraints files + name: Update pip constraints + needs: diff + if: > + github.event.pull_request.head.repo.full_name == github.repository && + needs.diff.outputs.diff != '' + # Only run if PR does not come from a fork + # https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -21,40 +43,29 @@ jobs: - "3.10" steps: - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Check if there are dependency changes - run: | - DIFF="$(git diff origin/main --color -- .constraints setup.cfg)" - echo ::set-output name=diff::"${DIFF}" - id: diff - uses: ComPWA/update-pip-constraints@main - if: steps.diff.outputs.diff != '' with: python-version: ${{ matrix.python-version }} pre-commit: name: pre-commit autoupdate + needs: diff + if: > + github.event.pull_request.head.repo.full_name == github.repository && + needs.diff.outputs.diff != '' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Check if there are changes to pre-commit config - run: | - DIFF="$(git diff origin/main --color -- .pre-commit-config.yaml)" - echo ::set-output name=diff::"${DIFF}" - id: diff - uses: ComPWA/update-pre-commit@main - if: steps.diff.outputs.diff != '' push: name: Push changes - if: github.event.pull_request.head.repo.full_name == github.repository - # Only run if PR does not come from a fork - # https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow + if: > + github.event.pull_request.head.repo.full_name == github.repository && + needs.diff.outputs.diff != '' runs-on: ubuntu-20.04 needs: + - diff - pip-constraints - pre-commit steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7726db904..ecceb32e7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.0.88 + rev: 0.0.92 hooks: - id: check-dev-files args: @@ -136,7 +136,7 @@ repos: - id: pydocstyle - repo: https://github.com/ComPWA/mirrors-pyright - rev: v1.1.190 + rev: v1.1.191 hooks: - id: pyright diff --git a/pytest.ini b/pytest.ini index 8282e51e6..e8832af9a 100644 --- a/pytest.ini +++ b/pytest.ini @@ -14,11 +14,8 @@ addopts = filterwarnings = error ignore:.*invalid value encountered in sqrt.*:RuntimeWarning -nb_diff_ignore = - /cells/*/execution_count - /cells/*/outputs - /metadata/language_info/version - /metadata/widgets + ignore:Passing a schema to Validator.iter_errors is deprecated.*:DeprecationWarning + ignore:unclosed .*:ResourceWarning norecursedirs = _build markers = diff --git a/setup.cfg b/setup.cfg index 286c43a18..356b8d22a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,7 +43,7 @@ python_requires = >=3.6 setup_requires = setuptools_scm install_requires = - attrs >=20.1.0 # on_setattr + attrs >=20.1.0 # on_setattr and https://www.attrs.org/en/stable/api.html#next-gen qrules ==0.9.* sympy >=1.8 # module sympy.printing.numpy typing-extensions; python_version <"3.8.0" @@ -77,10 +77,10 @@ doc = test = black ipywidgets # symplot + nbmake numpy pytest pytest-cov - pytest-notebook pytest-profiling pytest-xdist format = diff --git a/src/ampform/dynamics/builder.py b/src/ampform/dynamics/builder.py index b15b80bea..4adf4ca0b 100644 --- a/src/ampform/dynamics/builder.py +++ b/src/ampform/dynamics/builder.py @@ -24,7 +24,7 @@ from typing_extensions import Protocol -@attr.s(frozen=True) +@attr.frozen class TwoBodyKinematicVariableSet: """Data container for the essential variables of a two-body decay. diff --git a/src/ampform/helicity/__init__.py b/src/ampform/helicity/__init__.py index 9830cc3fd..761f52345 100644 --- a/src/ampform/helicity/__init__.py +++ b/src/ampform/helicity/__init__.py @@ -85,7 +85,7 @@ def __attempt_number_cast(text: str) -> Union[float, str]: return text -@attr.s(frozen=True) +@attr.frozen class HelicityModel: # noqa: R701 expression: sp.Expr = attr.ib( validator=attr.validators.instance_of(sp.Expr) diff --git a/src/ampform/helicity/decay.py b/src/ampform/helicity/decay.py index ef1d22b73..4c326bf99 100644 --- a/src/ampform/helicity/decay.py +++ b/src/ampform/helicity/decay.py @@ -9,7 +9,7 @@ from ampform.kinematics import _assert_two_body_decay -@attr.s(auto_attribs=True, frozen=True) +@attr.frozen class StateWithID(State): """Extension of `~qrules.transition.State` that embeds the state ID.""" @@ -27,7 +27,7 @@ def from_transition( ) -@attr.s(auto_attribs=True, frozen=True) +@attr.frozen class TwoBodyDecay: """Two-body sub-decay in a `~qrules.transition.StateTransition`. diff --git a/tox.ini b/tox.ini index 850fb548e..8226bcef3 100644 --- a/tox.ini +++ b/tox.ini @@ -112,18 +112,16 @@ passenv = HOME description = Perform all linting, formatting, and spelling checks setenv = - SKIP = mypy, pyright + SKIP = pyright allowlist_externals = - mypy pre-commit commands = - mypy src tests # run separately because of potential caching problems pre-commit run {posargs} -a -[testenv:testnb] +[testenv:nb] description = Run all notebooks with pytest allowlist_externals = pytest commands = - pytest {posargs:docs} --nb-test-files + pytest --nbmake {posargs:docs}