Skip to content

Commit

Permalink
MAINT: apply fixes by pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Sep 10, 2024
1 parent eac0abb commit 864f70d
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 61 deletions.
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
"*particle*.*ml",
".constraints/*.txt",
".editorconfig",
".envrc",
".gitattributes",
".gitignore",
".gitpod.*",
".pre-commit-config.yaml",
".prettierignore",
".readthedocs.yml",
Expand Down
11 changes: 10 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
layout anaconda
if [ -e .venv ]; then
source .venv/bin/activate
elif [ -e venv ]; then
source venv/bin/activate
elif [ -e .pixi ]; then
watch_file pixi.lock
eval "$(pixi shell-hook)"
else
layout anaconda
fi
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pixi.lock linguist-language=YAML linguist-generated=true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ typings/

# Virtual environments
*venv/
.pixi/
.tox/
pyvenv*/

Expand Down
36 changes: 0 additions & 36 deletions .gitpod.yml

This file was deleted.

32 changes: 15 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,37 @@ ci:
autoupdate_schedule: quarterly # already done by requirements-cron.yml
skip:
- mypy
- prettier
- pyright
- taplo

repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 0.4.0
hooks:
- id: check-dev-files
args:
- --doc-apt-packages=graphviz
- --github-pages
- --no-prettierrc
- --pin-requirements=bimonthly
- --repo-name=ampform-dpd
- --repo-title=AmpForm-DPD
- id: colab-toc-visible
- id: remove-empty-tags

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
args:
- --drop-empty-cells
- --extra-keys
- |
cell.attachments
cell.id
cell.metadata.code_folding
cell.metadata.editable
cell.metadata.id
Expand All @@ -41,20 +53,6 @@ repos:
metadata.varInspector
metadata.vscode
- repo: https://github.com/ComPWA/policy
rev: 0.4.0
hooks:
- id: check-dev-files
args:
- --doc-apt-packages=graphviz
- --github-pages
- --no-prettierrc
- --pin-requirements=bimonthly
- --repo-name=ampform-dpd
- --repo-title=AmpForm-DPD
- id: colab-toc-visible
- id: remove-empty-tags

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.4
hooks:
Expand Down
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"executablebookproject.myst-highlight",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"ms-python.python",
"mhutchie.git-graph",
"ms-python.mypy-type-checker",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.vscode-jupyter-cell-tags",
"ms-vscode.live-server",
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"diffEditor.experimental.showMoves": true,
"editor.formatOnSave": true,
"files.associations": {
"**/.constraints/py*.txt": "pip-requirements"
"**/.constraints/py*.txt": "pip-requirements",
"**/pixi.lock": "yaml"
},
"files.eol": "\n",
"github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"],
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ComPWA/ampform-dpd/main.svg)](https://results.pre-commit.ci/latest/github/ComPWA/ampform-dpd/main)
[![Test coverage](https://codecov.io/gh/ComPWA/ampform-dpd/branch/main/graph/badge.svg)](https://codecov.io/gh/ComPWA/ampform-dpd)

[![GitPod](https://img.shields.io/badge/gitpod-open-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ComPWA/ampform-dpd)
[![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)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Notice the general structure:
If $k=1$, we have $\hat\theta_{k(1)}=0$, so the Wigner $d$ function for the production isobar reduces to a Kronecker delta, $d^J_{\nu,\tau-\lambda'_k}\!\left(\hat\theta_{k(1)}\right) = \delta_{\nu,\tau-\lambda'_k}$.

[^1]: Alternatively, one can sum over all resonances themselves, so that one has a dynamic function $X_\mathcal{R}(\sigma_k)$ for each resonance $\mathcal{R}$ in subsystem $k$.

[^2]: See also {cite}`JPAC:2021rxu`, Section 2.1.

Equation {eq}`aligned-amplitude` is written in terms of _helicity_ couplings, but can be rewritten in terms of _$LS$ couplings_, using
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ dependencies:
- pip:
- -c .constraints/py3.9.txt -e .[dev]
variables:
PRETTIER_LEGACY_CLI: "1"
PYTHONHASHSEED: 0
101 changes: 99 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ namespaces = false
where = ["src"]

[tool.setuptools_scm]
local_scheme = "no-local-version"
version_scheme = "post-release"
write_to = "src/ampform_dpd/version.py"

[tool.mypy]
Expand All @@ -156,6 +158,103 @@ disallow_incomplete_defs = false
disallow_untyped_defs = false
module = ["tests.*"]

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64"]

[tool.pixi.activation.env]
PRETTIER_LEGACY_CLI = "1"
PYTHONHASHSEED = "0"

[tool.pixi.dependencies]
graphviz = "*"
python = "3.9.*"

[tool.pixi.environments]
default = {features = [
"dev",
"doc",
"jax",
"jupyter",
"numba",
"sty",
"tensorflow",
"test",
"tf",
"types",
]}

[tool.pixi.feature.dev.tasks.ci]
depends_on = ["cov", "docnb", "linkcheck", "sty"]

[tool.pixi.feature.dev.tasks.cov]
cmd = """
pytest src tests \
--cov-fail-under=50 \
--cov-report=html \
--cov-report=xml \
--cov=ampform_dpd
"""

[tool.pixi.feature.dev.tasks.doc]
cmd = "sphinx-build -nW --keep-going -b html docs/ docs/_build/html"
env = {FORCE_COLOR = "yes"}

[tool.pixi.feature.dev.tasks.doclive]
cmd = """
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
"""
env = {FORCE_COLOR = "yes"}

[tool.pixi.feature.dev.tasks.docnb]
cmd = "pixi run doc"
env = {EXECUTE_NB = "yes", FORCE_COLOR = "yes"}

[tool.pixi.feature.dev.tasks.docnb-force]
cmd = "pixi run doc"
env = {FORCE_COLOR = "yes", FORCE_EXECUTE_NB = "yes"}

[tool.pixi.feature.dev.tasks.docnblive]
cmd = "pixi run doclive"
env = {EXECUTE_NB = "yes", FORCE_COLOR = "yes"}

[tool.pixi.feature.dev.tasks.linkcheck]
cmd = """
sphinx-build \
-T \
-b linkcheck \
docs/ docs/_build/linkcheck
"""
env = {FORCE_COLOR = "yes"}

[tool.pixi.feature.dev.tasks.nb]
cmd = "pytest --nbmake --nbmake-timeout=3600 docs"

[tool.pixi.feature.dev.tasks.sty]
cmd = "pre-commit run -a"
env = {SKIP = "pyright"}

[tool.pixi.feature.dev.tasks.tests]
cmd = "pytest"

[tool.pixi.pypi-dependencies]
ampform-dpd = {path = ".", editable = true}

[tool.pyright]
reportArgumentType = false
reportAssignmentType = false
Expand Down Expand Up @@ -221,7 +320,6 @@ src = [
"src",
"tests",
]
target-version = "py38"

[tool.ruff.format]
docstring-code-format = true
Expand Down Expand Up @@ -361,6 +459,5 @@ sort_first = [
"tool.setuptools",
"tool.setuptools_scm",
]
sort_table_keys = true
spaces_indent_inline_array = 4
trailing_comma_inline_array = true

0 comments on commit 864f70d

Please sign in to comment.