From c5b249f8dfb24b94c4e20d21a205f47530d3836b Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:17:20 +0200 Subject: [PATCH 01/12] MAINT: autoupdate pre-commit --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 76fd954..193e2cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.9.1 hooks: - id: black @@ -45,7 +45,7 @@ repos: - id: isort - repo: https://github.com/cmhughes/latexindent.pl - rev: V3.22.2 + rev: V3.23.2 hooks: - id: latexindent args: @@ -82,6 +82,6 @@ repos: metadata.vscode - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.2 + rev: v3.0.3 hooks: - id: prettier From a9e64bfe85d9bac23e0ef28c32361cacd0095c50 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:20:47 +0200 Subject: [PATCH 02/12] DX: format notebooks with official hook for `black` --- .pre-commit-config.yaml | 4 +++- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 193e2cb..3fac6ca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,9 @@ repos: rev: 23.9.1 hooks: - id: black + - id: black-jupyter + args: [--line-length=85] + types_or: [jupyter] - repo: https://github.com/pre-commit/mirrors-clang-format rev: v16.0.6 @@ -54,7 +57,6 @@ repos: - repo: https://github.com/nbQA-dev/nbQA rev: 1.7.0 hooks: - - id: nbqa-black - id: nbqa-isort - repo: https://github.com/kynan/nbstripout diff --git a/pyproject.toml b/pyproject.toml index a7527c1..7dd0f39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,4 +41,4 @@ known_third_party = "THIRDPARTY,sympy" profile = "black" [tool.nbqa.addopts] -black = ["--line-length=85"] +isort = ["--line-length=85"] From b0f356afdc49de3298f163a06da146aee5298fe5 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:21:41 +0200 Subject: [PATCH 03/12] DOC: make Colab TOC visible by default --- .pre-commit-config.yaml | 5 +++++ docs/widget.ipynb | 3 +++ 2 files changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3fac6ca..a396523 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,6 +25,11 @@ repos: - id: mixed-line-ending - id: trailing-whitespace + - repo: https://github.com/ComPWA/repo-maintenance + rev: 0.0.198 + hooks: + - id: colab-toc-visible + - repo: https://github.com/psf/black rev: 23.9.1 hooks: diff --git a/docs/widget.ipynb b/docs/widget.ipynb index a6262a1..0c49806 100644 --- a/docs/widget.ipynb +++ b/docs/widget.ipynb @@ -640,6 +640,9 @@ } ], "metadata": { + "colab": { + "toc_visible": true + }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", From ba0289aa4860de7380ad740a97ed8028fc281641 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Sun, 8 Oct 2023 15:47:01 +0200 Subject: [PATCH 04/12] MAINT: autoupdate pre-commit hooks --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a396523..eb30138 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,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 @@ -26,7 +26,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.0.198 + rev: 0.1.0rc1 hooks: - id: colab-toc-visible From c31eccf6580b4d5f157ec19a7a09d633d322b829 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Sun, 8 Oct 2023 15:47:17 +0200 Subject: [PATCH 05/12] DOC: add Prettier badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0ee6d23..42e482d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Comparison repository for GlueX amplitude models +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) + This repository was created during PWA working group meetings for GlueX at Jefferson Lab, July 31st to August 4th, 2023. Live notes for these discussions can be found [here](https://hackmd.io/@QHYjhejHTIWXL2MltV3WNQ/r17prtBo3) on HackMD. Each meeting was organised like a 'hackathon' and the results of these programming sessions can be found on [compwa.github.io/gluex-amplitude](https://compwa.github.io/gluex-amplitude). The main target for the week was to implement a simple intensity function for two-pseudoscalar system with photo-production: From 64fac80594d29afeb0d298e7511bf53504a99db2 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:02:43 +0200 Subject: [PATCH 06/12] DOC: add BSD 3-Clause License file --- LICENSE | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..627f124 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2021, Common Partial Wave Analysis +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From d2a5bf17e4707e8af4b5731af00268ee67cea23d Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:05:15 +0200 Subject: [PATCH 07/12] DX: enforce ComPWA developer environment --- .editorconfig | 6 +++-- .pre-commit-config.yaml | 58 ++++++++++++++++++++++++++++++++++++----- .prettierignore | 1 + .taplo.toml | 3 +++ .vscode/extensions.json | 8 ++++++ .vscode/settings.json | 30 ++++++++++++--------- pyproject.toml | 50 ++++++++++++++++++++++++++++++++++- 7 files changed, 135 insertions(+), 21 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3146498..456c8b6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,12 +3,14 @@ root = true [*] end_of_line = lf indent_size = 2 -indent_style = space insert_final_newline = true trim_trailing_whitespace = true -[*.{ipynb,md}] +[*.{c,cc,h,hh,ipynb,md}] indent_size = unset [*.{py,toml}] indent_size = 4 + +[.gitmodules] +indent_size = unset diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eb30138..ccdc620 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 @@ -26,9 +28,27 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.1.0rc1 + rev: 0.1.0rc2 hooks: - id: colab-toc-visible + - id: check-dev-files + args: + - --ignore-author + - --no-github-actions + - --no-gitpod + - --no-prettierrc + - --no-pypi + - --no-ruff + - --no-version-branches + - --repo-name=gluex-amplitude + + - repo: https://github.com/nbQA-dev/nbQA + rev: 1.7.0 + hooks: + - id: nbqa-isort + - id: nbqa-pyupgrade + args: + - --py37-plus - repo: https://github.com/psf/black rev: 23.9.1 @@ -47,6 +67,17 @@ repos: - c - cuda + - repo: https://github.com/editorconfig-checker/editorconfig-checker.python + rev: 2.7.2 + hooks: + - id: editorconfig-checker + name: editorconfig + alias: ec + exclude: >- + (?x)^( + .*\.py + )$ + - repo: https://github.com/PyCQA/isort rev: 5.12.0 hooks: @@ -59,11 +90,6 @@ repos: args: - "-y=defaultIndent: ' '" - - repo: https://github.com/nbQA-dev/nbQA - rev: 1.7.0 - hooks: - - id: nbqa-isort - - repo: https://github.com/kynan/nbstripout rev: 0.6.1 hooks: @@ -74,6 +100,7 @@ repos: cell.attachments cell.metadata.code_folding cell.metadata.id + cell.metadata.pycharm cell.metadata.user_expressions metadata.celltoolbar metadata.colab.name @@ -92,3 +119,22 @@ repos: rev: v3.0.3 hooks: - id: prettier + + - repo: https://github.com/asottile/pyupgrade + rev: v3.15.0 + hooks: + - id: pyupgrade + args: + - --py37-plus + + - 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/.prettierignore b/.prettierignore index fa65608..ea965b8 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,2 @@ *.ipynb +LICENSE diff --git a/.taplo.toml b/.taplo.toml index bcd3669..0db1df7 100644 --- a/.taplo.toml +++ b/.taplo.toml @@ -1,9 +1,12 @@ [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 8c616cb..81de77a 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,6 +5,7 @@ "editorconfig.editorconfig", "esbenp.prettier-vscode", "executablebookproject.myst-highlight", + "garaioag.garaio-vscode-unwanted-recommendations", "github.vscode-github-actions", "github.vscode-pull-request-github", "james-yu.latex-workshop", @@ -19,7 +20,14 @@ "ms-vscode.makefile-tools", "ms-vsliveshare.vsliveshare", "redhat.vscode-yaml", + "stkb.rewrap", "tamasfe.even-better-toml", "yzhang.markdown-all-in-one" + ], + "unwantedRecommendations": [ + "bungcip.better-toml", + "davidanson.vscode-markdownlint", + "ms-python.mypy-type-checker", + "travisillig.vscode-json-stable-stringify" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 2d1a8fc..3c4765b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "[git-commit]": { + "editor.rulers": [72], "rewrap.wrappingColumn": 72 }, "[json]": { @@ -14,11 +15,14 @@ "[python]": { "editor.codeActionsOnSave": { "source.organizeImports": true - } + }, + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.rulers": [88] }, "[yaml]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "black-formatter.importStrategy": "fromEnvironment", "editor.formatOnSave": true, "git.autofetch": true, "git.autoRepositoryDetection": false, @@ -45,6 +49,16 @@ } ], "latex-workshop.latex.tools": [ + { + "args": ["--no-fonts", "%DOC%"], + "command": "dvisvgm", + "name": "svg" + }, + { + "args": ["--output-format=dvi", "%DOC%"], + "command": "lualatex", + "name": "dvi" + }, { "args": [ "-synctex=1", @@ -54,17 +68,9 @@ ], "command": "lualatex", "name": "pdf" - }, - { - "args": ["--output-format=dvi", "%DOC%"], - "command": "lualatex", - "name": "dvi" - }, - { - "args": ["--no-fonts", "%DOC%"], - "command": "dvisvgm", - "name": "svg" } ], - "livePreview.defaultPreviewPath": "docs/_build/html" + "livePreview.defaultPreviewPath": "docs/_build/html", + "notebook.gotoSymbols.showAllSymbols": true, + "rewrap.wrappingColumn": 88 } diff --git a/pyproject.toml b/pyproject.toml index 7dd0f39..80f3488 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,24 @@ - [build-system] build-backend = "setuptools.build_meta" requires = ["setuptools"] [project] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Scientific/Engineering", +] dependencies = [ "ampform", "ipympl", @@ -14,6 +29,8 @@ dependencies = [ "sympy", "uproot", ] +description = "Investigation of symbolic amplitude models for the GlueX experiment" +license = {text = "BSD 3-Clause License"} name = "gluex-amplitude" requires-python = ">=3.7" version = "0.0.0" @@ -36,9 +53,40 @@ sty = [ "pre-commit", ] +[project.readme] +content-type = "text/markdown" +file = "README.md" + +[tool.black] +preview = true +target-version = [ + "py310", + "py311", + "py37", + "py38", + "py39", +] + [tool.isort] known_third_party = "THIRDPARTY,sympy" profile = "black" [tool.nbqa.addopts] isort = ["--line-length=85"] + +[tool.pyright] +typeCheckingMode = "strict" + +[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 From 2218e3c24d4848245a354df87c0c58718ba86ccb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:05:37 +0000 Subject: [PATCH 08/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- script/makeComparison.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/makeComparison.py b/script/makeComparison.py index 20dd578..888b45e 100644 --- a/script/makeComparison.py +++ b/script/makeComparison.py @@ -10,7 +10,7 @@ # Load the intensities extracted by print_amplitudes.cc intensities = [] -with open(".print_amplitudes.log", "r") as file: +with open(".print_amplitudes.log") as file: for line in file: if "INTENSITY =" in line: line = re.sub(" +", " ", line.rstrip().lstrip()) From e8d9d7773b26f88df2c003cde6efa455f78aa5ad Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:20:27 +0200 Subject: [PATCH 09/12] FIX: remove `pyright` config --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 80f3488..6477948 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,9 +74,6 @@ profile = "black" [tool.nbqa.addopts] isort = ["--line-length=85"] -[tool.pyright] -typeCheckingMode = "strict" - [tool.tomlsort] all = false ignore_case = true From 67ecb1bf6f47cfd974ba15c536ef6938a8b563a0 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:14:59 +0200 Subject: [PATCH 10/12] FIX: update line numbers `index.md` --- docs/index.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/index.md b/docs/index.md index 43b7eb9..10d6fe3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,8 +1,8 @@ # GlueX amplitude model ```{include} ../README.md -:start-line: 2 -:end-line: 6 +:start-line: 4 +:end-line: 8 ``` ```{math} @@ -16,16 +16,16 @@ I(\Omega,\Phi) = 2\kappa\sum_{k}\left( ``` ```{include} ../README.md -:start-line: 8 -:end-line: 10 +:start-line: 10 +:end-line: 12 ``` :::{figure} fig/feynman-gluex-two-pseudoscalar.svg ::: ```{include} ../README.md -:start-line: 12 -:end-line: 13 +:start-line: 14 +:end-line: 15 ``` :::{figure} fig/feynman-gluex-vector-meson.svg From 416e4cf73f79d6dbd205faeda7e829866b7af95a Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:16:20 +0200 Subject: [PATCH 11/12] MAINT: autoupdate pre-commit config --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ccdc620..e80736a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.1.0rc2 + rev: 0.1.0rc3 hooks: - id: colab-toc-visible - id: check-dev-files From 512241d72b9beaabeb5f39ebad3084ca3cfe37cf Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 9 Oct 2023 17:38:34 +0200 Subject: [PATCH 12/12] MAINT: autoupdate pre-commit config --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e80736a..8891982 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.1.0rc3 + rev: 0.1.0 hooks: - id: colab-toc-visible - id: check-dev-files