diff --git a/.cspell.json b/.cspell.json index fcf6504..6203953 100644 --- a/.cspell.json +++ b/.cspell.json @@ -1,108 +1,108 @@ { - "version": "0.2", - "flagWords": [ - "analyse", - "colour", - "comparision", - "favour", - "flavour", - "hte", - "optimise", - "paramater", - "parmater", - "transision", - "transisions" - ], - "ignorePaths": [ - "**/.cspell.json", - ".github/workflows", - ".gitignore", - ".pre-commit-config.yaml", - ".vscode/*", - "environment.yml", - "pyproject.toml", - "requirements*.in", - "requirements*.txt", - "tox.ini" - ], - "language": "en-US", - "words": [ - "AmpForm", - "BESIII", - "Blatt", - "Breit", - "CHEP", - "ComPWA", - "Conda", - "façade", - "FDSA", - "helicity", - "IPython", - "lambdified", - "matplotlib", - "numba", - "NumPy", - "ODSL", - "QRules", - "SymPy", - "TensorWaves", - "unbinned", - "Weisskopf" - ], - "ignoreWords": [ - "Colab", - "Colaboratory", - "Miniconda", - "absl", - "asdot", - "autoreload", - "axhline", - "axvline", - "charmness", - "codemirror", - "dotprint", - "elif", - "eqnarray", - "figsize", - "filterwarnings", - "functools", - "genfromtxt", - "getsource", - "graphviz", - "gridspec", - "histtype", - "iplt", - "ipykernel", - "ipympl", - "ipynb", - "ipyplot", - "ipywidgets", - "isinstance", - "jaxlib", - "kernelspec", - "kmatrix", - "lambdify", - "linestyle", - "linspace", - "maxsize", - "nbconvert", - "nbformat", - "nbmake", - "nrows", - "phsp", - "posify", - "preorder", - "pygments", - "pyplot", - "pytest", - "rtfd", - "sharex", - "startswith", - "symplot", - "timeit", - "traceback", - "xlabel", - "xreplace", - "yticks" - ] + "version": "0.2", + "flagWords": [ + "analyse", + "colour", + "comparision", + "favour", + "flavour", + "hte", + "optimise", + "paramater", + "parmater", + "transision", + "transisions" + ], + "ignorePaths": [ + "**/.cspell.json", + ".github/workflows", + ".gitignore", + ".pre-commit-config.yaml", + ".vscode/*", + "environment.yml", + "pyproject.toml", + "requirements*.in", + "requirements*.txt", + "tox.ini" + ], + "language": "en-US", + "words": [ + "AmpForm", + "BESIII", + "Blatt", + "Breit", + "CHEP", + "ComPWA", + "Conda", + "façade", + "FDSA", + "helicity", + "IPython", + "lambdified", + "matplotlib", + "numba", + "NumPy", + "ODSL", + "QRules", + "SymPy", + "TensorWaves", + "unbinned", + "Weisskopf" + ], + "ignoreWords": [ + "Colab", + "Colaboratory", + "Miniconda", + "absl", + "asdot", + "autoreload", + "axhline", + "axvline", + "charmness", + "codemirror", + "dotprint", + "elif", + "eqnarray", + "figsize", + "filterwarnings", + "functools", + "genfromtxt", + "getsource", + "graphviz", + "gridspec", + "histtype", + "iplt", + "ipykernel", + "ipympl", + "ipynb", + "ipyplot", + "ipywidgets", + "isinstance", + "jaxlib", + "kernelspec", + "kmatrix", + "lambdify", + "linestyle", + "linspace", + "maxsize", + "nbconvert", + "nbformat", + "nbmake", + "nrows", + "phsp", + "posify", + "preorder", + "pygments", + "pyplot", + "pytest", + "rtfd", + "sharex", + "startswith", + "symplot", + "timeit", + "traceback", + "xlabel", + "xreplace", + "yticks" + ] } diff --git a/.editorconfig b/.editorconfig index 2d5f62c..88befe6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,22 +2,19 @@ root = true [*] end_of_line = lf +indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true -[Makefile] -indent_style = tab +[*.{ipynb,md}] +indent_size = unset [*.{py,toml}] indent_size = 4 -[*.{json,yaml,yml}] -indent_size = 2 - -[*.{rst,inc}] -indent_size = 2 +[LICENSE] +indent_size = unset -# when adding words through vscode, this is the resulting output format -[.cspell.json] +[setup.cfg] indent_size = 4 diff --git a/.github/workflows/clean-caches.yml b/.github/workflows/clean-caches.yml new file mode 100644 index 0000000..a66c407 --- /dev/null +++ b/.github/workflows/clean-caches.yml @@ -0,0 +1,22 @@ +name: Clean caches + +on: + pull_request: + types: + - closed + workflow_dispatch: + inputs: + ref: + description: Clean caches for this branch name or ref + required: false + type: string + +jobs: + cleanup: + name: Remove caches + runs-on: ubuntu-22.04 + steps: + - uses: ComPWA/actions/clean-caches@v1 + with: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ref: ${{ inputs.ref }} diff --git a/.github/workflows/pr-linting.yml b/.github/workflows/pr-linting.yml new file mode 100644 index 0000000..cd3bb74 --- /dev/null +++ b/.github/workflows/pr-linting.yml @@ -0,0 +1,33 @@ +name: PR linting +on: + pull_request: + types: + - edited + - labeled + - opened + - reopened + - synchronize + - unlabeled + +jobs: + check-labels: + name: Check labels + runs-on: ubuntu-22.04 + steps: + - uses: docker://agilepathway/pull-request-label-checker:latest # cspell:ignore agilepathway + with: + any_of: >- + 🐛 Bug,✨ Feature,⚙️ Enhancement,⚠️ Interface,❗ Behavior,📝 Docs,🔨 Maintenance,🖱️ DX + none_of: Epic,💫 Good first issue + repo_token: ${{ secrets.GITHUB_TOKEN }} + + check-title: + name: Check title + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - run: npm install @compwa/commitlint-config + - name: Create commitlint config + run: | + echo "module.exports = {extends: ['@compwa/commitlint-config']}" > commitlint.config.js + - uses: JulienKode/pull-request-name-linter-action@v0.5.0 # cspell:ignore kode diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b803a69..b492731 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,8 @@ ci: autoupdate_commit_msg: "MAINT: autoupdate pre-commit hooks" autoupdate_schedule: quarterly + skip: + - taplo repos: - repo: meta @@ -9,7 +11,7 @@ repos: - id: check-useless-excludes - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-case-conflict - id: check-json @@ -25,13 +27,44 @@ repos: - id: mixed-line-ending - id: trailing-whitespace + - repo: https://github.com/ComPWA/repo-maintenance + rev: 0.1.0 + hooks: + - id: check-dev-files + args: + - --no-cspell-update + - --no-github-actions + - --no-gitpod + - --no-prettierrc + - --no-pypi + - --no-python + - --no-ruff + - --no-version-branches + - --repo-name=ComPWA-demo + - --repo-title="ComPWA demos" + - id: colab-toc-visible + + - repo: https://github.com/nbQA-dev/nbQA + rev: 1.7.0 + hooks: + - id: nbqa-flake8 + - id: nbqa-isort + - id: nbqa-pyupgrade + args: + - --py36-plus + + - repo: https://github.com/psf/black + rev: 23.9.1 + hooks: + - id: black-jupyter + - repo: https://github.com/asottile/blacken-docs rev: 1.16.0 hooks: - id: blacken-docs - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v7.3.0 + rev: v7.3.1 hooks: - id: cspell @@ -39,16 +72,8 @@ repos: rev: 2.7.2 hooks: - id: editorconfig-checker - - - repo: https://github.com/nbQA-dev/nbQA - rev: 1.7.0 - hooks: - - id: nbqa-black - - id: nbqa-flake8 - - id: nbqa-isort - - id: nbqa-pyupgrade - args: - - --py36-plus + name: editorconfig + alias: ec - repo: https://github.com/kynan/nbstripout rev: 0.6.1 @@ -56,9 +81,11 @@ repos: - id: nbstripout args: - --extra-keys - - > + - | + cell.attachments cell.metadata.code_folding cell.metadata.id + cell.metadata.pycharm cell.metadata.user_expressions metadata.celltoolbar metadata.colab.name @@ -77,3 +104,15 @@ repos: rev: v3.0.3 hooks: - id: prettier + + - repo: https://github.com/ComPWA/mirrors-taplo + rev: v0.8.1 + hooks: + - id: taplo + + - repo: https://github.com/pappasam/toml-sort + rev: v0.23.1 + hooks: + - id: toml-sort + args: + - --in-place diff --git a/.taplo.toml b/.taplo.toml index f5caabe..0db1df7 100644 --- a/.taplo.toml +++ b/.taplo.toml @@ -1,16 +1,12 @@ -exclude = [ - "**/Cargo.toml", - "**/Manifest.toml", - "**/Project.toml", - "labels*.toml", -] - [formatting] +align_comments = false align_entries = false +allowed_blank_lines = 1 array_auto_collapse = false array_auto_expand = true array_trailing_comma = true column_width = 88 +compact_inline_tables = true indent_string = " " reorder_arrays = true reorder_keys = true diff --git a/.vscode/extensions.json b/.vscode/extensions.json index cbc51bd..cc98fcc 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,13 +3,24 @@ "eamodio.gitlens", "editorconfig.editorconfig", "esbenp.prettier-vscode", + "garaioag.garaio-vscode-unwanted-recommendations", "github.vscode-github-actions", + "ms-python.black-formatter", + "ms-python.flake8", + "ms-python.isort", "ms-python.python", "ms-vsliveshare.vsliveshare", "redhat.vscode-yaml", + "stkb.rewrap", "streetsidesoftware.code-spell-checker", "tamasfe.even-better-toml", "tyriar.sort-lines", "yzhang.markdown-all-in-one" + ], + "unwantedRecommendations": [ + "bungcip.better-toml", + "davidanson.vscode-markdownlint", + "ms-python.pylint", + "travisillig.vscode-json-stable-stringify" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index a5fa3b2..986a1dc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,10 @@ "[bibtex]": { "editor.formatOnSave": false }, + "[git-commit]": { + "editor.rulers": [72], + "rewrap.wrappingColumn": 72 + }, "[ipynb]": { "editor.formatOnSave": false }, @@ -24,13 +28,10 @@ }, "cSpell.enabled": true, "editor.formatOnSave": true, - "editor.rulers": [88], "git.rebaseWhenSync": true, + "github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"], "python.analysis.autoImportCompletions": false, - "python.analysis.diagnosticMode": "workspace", - "python.formatting.provider": "black", "python.languageServer": "Pylance", - "python.linting.enabled": false, "python.testing.unittestEnabled": false, "rewrap.wrappingColumn": 88 } diff --git a/README.md b/README.md index b93c77b..795de3a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # ComPWA demo notebooks +[![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) + A collection of Jupyter notebooks that demonstrate features of the [ComPWA](https://github.com/ComPWA) packages [QRules](https://qrules.rtfd.io), [AmpForm](https://ampform.rtfd.io), and [TensorWaves](https://tensorwaves.rtfd.io). The notebooks are self-contained in the sense that they define their own pinned requirements and can be run independently in [Binder](https://mybinder.org) or [Google Colaboratory](https://research.google.com/colaboratory). ## Presentations diff --git a/binder/requirements.txt b/binder/requirements.txt index a502204..84902ba 100644 --- a/binder/requirements.txt +++ b/binder/requirements.txt @@ -7,35 +7,35 @@ asttokens==2.4.0 backcall==0.2.0 comm==0.1.4 -contourpy==1.1.0 -cycler==0.11.0 +contourpy==1.1.1 +cycler==0.12.1 decorator==5.1.1 -executing==1.2.0 -fonttools==4.42.1 -importlib-resources==6.0.1 -ipython==8.12.2 -ipywidgets==8.1.0 -jedi==0.19.0 -jupyterlab-widgets==3.0.8 +executing==2.0.0 +fonttools==4.43.1 +importlib-resources==6.1.0 +ipython==8.12.3 +ipywidgets==8.1.1 +jedi==0.19.1 +jupyterlab-widgets==3.0.9 kiwisolver==1.4.5 -matplotlib==3.7.2 +matplotlib==3.7.3 matplotlib-inline==0.1.6 numpy==1.24.4 -packaging==23.1 +packaging==23.2 parso==0.8.3 pexpect==4.8.0 pickleshare==0.7.5 -pillow==10.0.0 +pillow==10.0.1 prompt-toolkit==3.0.39 ptyprocess==0.7.0 pure-eval==0.2.2 pygments==2.16.1 -pyparsing==3.0.9 +pyparsing==3.1.1 python-dateutil==2.8.2 six==1.16.0 -stack-data==0.6.2 -traitlets==5.9.0 -typing-extensions==4.7.1 -wcwidth==0.2.6 -widgetsnbextension==4.0.8 -zipp==3.16.2 +stack-data==0.6.3 +traitlets==5.11.2 +typing-extensions==4.8.0 +wcwidth==0.2.8 +widgetsnbextension==4.0.9 +zipp==3.17.0 diff --git a/pyproject.toml b/pyproject.toml index a075e12..b79391c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,3 +21,17 @@ addopts = [ filterwarnings = [ "ignore:Passing a schema to Validator.iter_errors is deprecated.*:DeprecationWarning", ] + +[tool.tomlsort] +all = false +ignore_case = true +in_place = true +sort_first = [ + "build-system", + "project", + "tool.setuptools", + "tool.setuptools_scm", +] +sort_table_keys = true +spaces_indent_inline_array = 4 +trailing_comma_inline_array = true diff --git a/requirements.txt b/requirements.txt index ac89e54..f3abd2f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,85 +9,85 @@ aiosqlite==0.19.0 anyio==4.0.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 -arrow==1.2.3 +arrow==1.3.0 asttokens==2.4.0 async-lru==2.0.4 attrs==23.1.0 -babel==2.12.1 +babel==2.13.0 backcall==0.2.0 beautifulsoup4==4.12.2 -black==23.9.0 -bleach==6.0.0 +black==23.9.1 +bleach==6.1.0 cachetools==5.3.1 certifi==2023.7.22 -cffi==1.15.1 +cffi==1.16.0 cfgv==3.4.0 chardet==5.2.0 -charset-normalizer==3.2.0 +charset-normalizer==3.3.0 click==8.1.7 colorama==0.4.6 comm==0.1.4 -contourpy==1.1.0 -cycler==0.11.0 -debugpy==1.7.0 +contourpy==1.1.1 +cycler==0.12.1 +debugpy==1.8.0 decorator==5.1.1 defusedxml==0.7.1 distlib==0.3.7 exceptiongroup==1.1.3 -executing==1.2.0 -fastjsonschema==2.18.0 -filelock==3.12.3 -fonttools==4.42.1 +executing==2.0.0 +fastjsonschema==2.18.1 +filelock==3.12.4 +fonttools==4.43.1 fqdn==1.5.1 -identify==2.5.27 +identify==2.5.30 idna==3.4 importlib-metadata==6.8.0 -importlib-resources==6.0.1 +importlib-resources==6.1.0 ipykernel==6.25.2 -ipython==8.12.2 -ipywidgets==8.1.0 +ipython==8.12.3 +ipywidgets==8.1.1 isoduration==20.11.0 isort==5.12.0 -jedi==0.19.0 +jedi==0.19.1 jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 -jsonschema==4.19.0 +jsonschema==4.19.1 jsonschema-specifications==2023.7.1 jupyter-client==8.3.1 -jupyter-core==5.3.1 +jupyter-core==5.3.2 jupyter-events==0.7.0 jupyter-lsp==2.2.0 jupyter-server==2.7.3 jupyter-server-terminals==0.4.4 -jupyterlab==4.0.5 +jupyterlab==4.0.6 jupyterlab-code-formatter==2.2.1 jupyterlab-pygments==0.2.2 -jupyterlab-server==2.24.0 -jupyterlab-widgets==3.0.8 +jupyterlab-server==2.25.0 +jupyterlab-widgets==3.0.9 kiwisolver==1.4.5 markupsafe==2.1.3 -matplotlib==3.7.2 +matplotlib==3.7.3 matplotlib-inline==0.1.6 -mistune==3.0.1 +mistune==3.0.2 mypy-extensions==1.0.0 nbclient==0.8.0 -nbconvert==7.8.0 +nbconvert==7.9.2 nbformat==5.9.2 -nest-asyncio==1.5.7 +nest-asyncio==1.5.8 nodeenv==1.8.0 notebook-shim==0.2.3 numpy==1.24.4 overrides==7.4.0 -packaging==23.1 +packaging==23.2 pandocfilters==1.5.0 parso==0.8.3 pathspec==0.11.2 pexpect==4.8.0 pickleshare==0.7.5 -pillow==10.0.0 +pillow==10.0.1 pkgutil-resolve-name==1.3.10 -platformdirs==3.10.0 +platformdirs==3.11.0 pluggy==1.3.0 pre-commit==3.4.0 prometheus-client==0.17.1 @@ -97,7 +97,7 @@ ptyprocess==0.7.0 pure-eval==0.2.2 pycparser==2.21 pygments==2.16.1 -pyparsing==3.0.9 +pyparsing==3.1.1 pyproject-api==1.6.1 python-dateutil==2.8.2 python-json-logger==2.0.7 @@ -108,30 +108,31 @@ referencing==0.30.2 requests==2.31.0 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 -rpds-py==0.10.2 +rpds-py==0.10.4 send2trash==1.8.2 six==1.16.0 sniffio==1.3.0 soupsieve==2.5 -stack-data==0.6.2 +stack-data==0.6.3 terminado==0.17.1 tinycss2==1.2.1 tomli==2.0.1 tornado==6.3.3 tox==4.11.3 -traitlets==5.9.0 -typing-extensions==4.7.1 +traitlets==5.11.2 +types-python-dateutil==2.8.19.14 +typing-extensions==4.8.0 uri-template==1.3.0 -urllib3==2.0.4 +urllib3==2.0.6 virtualenv==20.24.5 -wcwidth==0.2.6 +wcwidth==0.2.8 webcolors==1.13 webencodings==0.5.1 -websocket-client==1.6.2 -widgetsnbextension==4.0.8 +websocket-client==1.6.4 +widgetsnbextension==4.0.9 y-py==0.5.9 ypy-websocket==0.8.2 -zipp==3.16.2 +zipp==3.17.0 # The following packages are considered to be unsafe in a requirements file: # setuptools