From a38928339575a060e8d823c5e21856b5cf22a0f2 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 9 Oct 2023 18:07:12 +0200 Subject: [PATCH] MAINT: autoupdate pre-commit hooks (#18) * DOC: make Colab TOC visible by default * DX: lint PRs with shared commitlint config * DX: merge `setup.cfg` into `pyproject.toml` * DX: switch to `black-jupyter` hook * DX: remove `.prettierrc` * DX: remove GitHub Issue templates * DX: synchronize ComPWA dev environment --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: GitHub --- .github/ISSUE_TEMPLATE/bug_report.md | 32 ------ .github/ISSUE_TEMPLATE/feature_request.md | 22 ---- .github/pull_request_template.md | 11 -- .github/workflows/pr-linting.yml | 33 ++++++ .github/workflows/release-drafter.yml | 2 +- .gitpod.yml | 30 ----- .pre-commit-config.yaml | 33 +++--- .taplo.toml | 10 +- .vscode/extensions.json | 3 + .vscode/settings.json | 18 +-- commitlint.config.js | 11 -- docs/visualize-jax-benchmark.ipynb | 3 + pyproject.toml | 130 ++++++++++++++++++---- setup.cfg | 61 ---------- setup.py | 3 - 15 files changed, 182 insertions(+), 220 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/pr-linting.yml delete mode 100644 .gitpod.yml delete mode 100644 commitlint.config.js delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index d0cc61c..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "" -labels: Bug -assignees: "" ---- - -## Bug description - - - - - -## How to reproduce? - -Steps to reproduce the behavior: - -1. - -## Expected behavior - - - -## System info - -Bug resulted on the following system: - -- OS: -- Version -- Python version: -- Virtual environment: diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 049eb32..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: "" -labels: "✨ Enhancement" -assignees: "" ---- - -## Problem description - - - -## Proposed solution - - - - - - - diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 14b8085..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ - - - - - 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/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index d54187d..d64f197 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -9,7 +9,7 @@ on: jobs: update_release_draft: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: release-drafter/release-drafter@v5 env: diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index dccfe0d..0000000 --- a/.gitpod.yml +++ /dev/null @@ -1,30 +0,0 @@ -tasks: - - init: pip install -e .[dev] - -github: - prebuilds: - master: true - branches: false - pullRequests: true - pullRequestsFromForks: true - addComment: false - addBadge: false - addLabel: false - -vscode: - extensions: - - eamodio.gitlens - - editorconfig.editorconfig - - esbenp.prettier-vscode - - github.vscode-github-actions - - github.vscode-pull-request-github - - ms-python.python - - ms-python.vscode-pylance - - ms-vscode.live-server - - ms-vsliveshare.vsliveshare - - oijaz.unicode-latex - - redhat.vscode-yaml - - stkb.rewrap - - tamasfe.even-better-toml - - tyriar.sort-lines - - yzhang.markdown-all-in-one diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0fd7d24..476bcdd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,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-ast - id: check-case-conflict @@ -27,7 +27,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/ComPWA/repo-maintenance - rev: 0.0.192 + rev: 0.1.0 hooks: - id: check-dev-files args: @@ -36,14 +36,10 @@ repos: - --no-pypi - --repo-name=ComPWA benchmarks - --repo-title=benchmarks - - id: format-setup-cfg - + - id: colab-toc-visible - repo: https://github.com/nbQA-dev/nbQA rev: 1.7.0 hooks: - - id: nbqa-black - additional_dependencies: - - black>=22.1.0 - id: nbqa-pyupgrade args: - --py37-plus @@ -52,9 +48,12 @@ repos: - --fix - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.9.1 hooks: - id: black + - id: black-jupyter + args: [--line-length=85] + types_or: [jupyter] - repo: https://github.com/editorconfig-checker/editorconfig-checker.python rev: 2.7.2 @@ -77,6 +76,7 @@ repos: cell.attachments cell.metadata.code_folding cell.metadata.id + cell.metadata.pycharm cell.metadata.user_expressions metadata.celltoolbar metadata.colab.name @@ -92,30 +92,37 @@ repos: metadata.vscode - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0 + rev: v3.0.3 hooks: - id: prettier - repo: https://github.com/ComPWA/mirrors-pyright - rev: v1.1.316 + rev: v1.1.330 hooks: - id: pyright - repo: https://github.com/asottile/pyupgrade - rev: v3.9.0 + rev: v3.15.0 hooks: - id: pyupgrade args: - --py37-plus - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.277 + rev: v0.0.292 hooks: - id: ruff args: - --fix - repo: https://github.com/ComPWA/mirrors-taplo - rev: v0.8.0 + 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 be4c9f8..973368a 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,9 +4,11 @@ "eamodio.gitlens", "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", "ms-python.python", "ms-python.vscode-pylance", "ms-vscode.live-server", @@ -20,6 +22,7 @@ ], "unwantedRecommendations": [ "bungcip.better-toml", + "davidanson.vscode-markdownlint", "ms-python.flake8", "ms-python.isort", "ms-python.mypy-type-checker", diff --git a/.vscode/settings.json b/.vscode/settings.json index 9740e18..11f34ff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { + "[git-commit]": { + "editor.rulers": [72], + "rewrap.wrappingColumn": 72 + }, "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, @@ -8,7 +12,6 @@ "[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.rulers": [], - "editor.wordWrap": "bounded", "editor.wordWrapColumn": 80, "editor.wrappingIndent": "same", "editor.wrappingStrategy": "advanced" @@ -16,26 +19,23 @@ "[python]": { "editor.codeActionsOnSave": { "source.organizeImports": true - } + }, + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.rulers": [88] }, "[yaml]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "cSpell.enabled": true, + "black-formatter.importStrategy": "fromEnvironment", "editor.formatOnSave": true, - "editor.rulers": [88], "files.associations": { ".cspell/*.txt": "plaintext" }, "files.eol": "\n", "github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"], "livePreview.defaultPreviewPath": "docs/_build/html", + "notebook.gotoSymbols.showAllSymbols": true, "python.analysis.autoImportCompletions": false, - "python.formatting.provider": "black", - "python.linting.enabled": true, - "python.linting.flake8Enabled": false, - "python.linting.pydocstyleEnabled": false, - "python.linting.pylintEnabled": false, "rewrap.wrappingColumn": 88, "ruff.enable": true, "ruff.organizeImports": true diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index d8b6bdc..0000000 --- a/commitlint.config.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - extends: ["@commitlint/config-conventional"], - rules: { - "type-case": [2, "always", ["upper-case"]], - "type-enum": [ - 2, - "always", - ["BEHAVIOR", "BREAK", "DOC", "DX", "ENH", "FEAT", "FIX", "MAINT"], - ], - }, -}; diff --git a/docs/visualize-jax-benchmark.ipynb b/docs/visualize-jax-benchmark.ipynb index 1a9ac7d..cfd2d03 100644 --- a/docs/visualize-jax-benchmark.ipynb +++ b/docs/visualize-jax-benchmark.ipynb @@ -448,6 +448,9 @@ } ], "metadata": { + "colab": { + "toc_visible": true + }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", diff --git a/pyproject.toml b/pyproject.toml index 61b16ed..4ced08a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,80 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools>=61.2"] + +[project] +authors = [{name = "Common Partial Wave Analysis", email = "compwa-admin@ep1.rub.de"}] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "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", + "Typing :: Typed", +] +dependencies = [ + "matplotlib", + "polarization-sensitivity @ git+https://github.com/redeboer/polarization-sensitivity@15f5ce0", + "tensorwaves[jax] >=0.4.5", # lambdify sympy.Indexed +] +description = "Benchmarks for amplitude analysis frameworks" +dynamic = ["version"] +license = {text = "GPLv3 or later"} +name = "benchmarks" +requires-python = ">=3.7" + +[project.optional-dependencies] +dev = [ + "benchmarks[doc]", + "benchmarks[jupyter]", + "benchmarks[sty]", + "sphinx-autobuild", + "tox >=1.9", # for skip_install, use_develop +] +doc = [ + "Sphinx >=3", + "myst-nb >=0.14", # nb_ configuration prefixes + "myst-parser[linkify]", + "pandas", + "sphinx-book-theme", + "sphinx-codeautolink[ipython]", + "sphinx-copybutton", + "sphinx-togglebutton", +] +format = [ + "black", +] +jupyter = [ + "jupyterlab >=3.0", + "jupyterlab-code-formatter", + 'jupyterlab-myst; python_version >="3.7.0"', +] +lint = [ + "ruff", +] +sty = [ + "benchmarks[format]", + "benchmarks[lint]", + "pre-commit >=1.4.0", +] + +[project.readme] +content-type = "text/markdown" +file = "README.md" + +[tool.setuptools] +include-package-data = false + [tool.black] exclude = ''' /( @@ -23,7 +100,6 @@ target-version = [ ] [tool.nbqa.addopts] -black = ["--line-length=85"] ruff = [ "--extend-ignore=B018", "--extend-ignore=C408", @@ -41,6 +117,25 @@ ruff = [ [tool.nbqa.exclude] flake8 = "^docs/appendix/benchmark.ipynb" +[tool.pyright] +reportGeneralTypeIssues = false +reportImportCycles = false +reportMissingParameterType = false +reportMissingTypeArgument = false +reportMissingTypeStubs = false +reportPrivateImportUsage = false +reportUnknownArgumentType = false +reportUnknownLambdaType = false +reportUnknownMemberType = false +reportUnknownParameterType = false +reportUnknownVariableType = false +reportUnnecessaryIsInstance = false +reportUnusedClass = true +reportUnusedFunction = true +reportUnusedImport = true +reportUnusedVariable = true +typeCheckingMode = "strict" + [tool.pytest.ini_options] addopts = [ "--color=yes", @@ -67,25 +162,6 @@ testpaths = [ "tests", ] -[tool.pyright] -reportGeneralTypeIssues = false -reportImportCycles = false -reportMissingParameterType = false -reportMissingTypeArgument = false -reportMissingTypeStubs = false -reportPrivateImportUsage = false -reportUnknownArgumentType = false -reportUnknownLambdaType = false -reportUnknownMemberType = false -reportUnknownParameterType = false -reportUnknownVariableType = false -reportUnnecessaryIsInstance = false -reportUnusedClass = true -reportUnusedFunction = true -reportUnusedImport = true -reportUnusedVariable = true -typeCheckingMode = "strict" - [tool.ruff] extend-select = [ "A", @@ -149,3 +225,17 @@ task-tags = ["cspell"] [tool.ruff.pydocstyle] convention = "google" + +[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/setup.cfg b/setup.cfg deleted file mode 100644 index 8589581..0000000 --- a/setup.cfg +++ /dev/null @@ -1,61 +0,0 @@ -[metadata] -name = benchmarks -description = Benchmarks for amplitude analysis frameworks -author = Common Partial Wave Analysis -author_email = compwa-admin@ep1.rub.de -classifiers = - Development Status :: 3 - Alpha - Intended Audience :: Developers - Intended Audience :: Education - Intended Audience :: Science/Research - License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Topic :: Scientific/Engineering - Topic :: Scientific/Engineering :: Physics - Typing :: Typed -license = GPLv3 or later -long_description = file: README.md -long_description_content_type = text/markdown - -[options] -python_requires = >=3.7 -install_requires = - matplotlib - polarization-sensitivity @ git+https://github.com/redeboer/polarization-sensitivity@15f5ce0 - tensorwaves[jax] >=0.4.5 # lambdify sympy.Indexed - -[options.extras_require] -doc = - myst-nb >=0.14 # nb_ configuration prefixes - myst-parser[linkify] - pandas - Sphinx >=3 - sphinx-book-theme - sphinx-codeautolink[ipython] - sphinx-copybutton - sphinx-togglebutton -jupyter = - jupyterlab >=3.0 - jupyterlab-code-formatter - jupyterlab-myst; python_version >="3.7.0" -format = - black -lint = - ruff -sty = - %(format)s - %(lint)s - pre-commit >=1.4.0 -dev = - %(doc)s - %(jupyter)s - %(sty)s - sphinx-autobuild - tox >=1.9 # for skip_install, use_develop diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup()