diff --git a/.cspell.json b/.cspell.json index 15846a25..40413434 100644 --- a/.cspell.json +++ b/.cspell.json @@ -19,8 +19,9 @@ "*particle*.*ml", ".constraints/*.txt", ".editorconfig", + ".envrc", + ".gitattributes", ".gitignore", - ".gitpod.*", ".pre-commit-config.yaml", ".prettierignore", ".readthedocs.yml", diff --git a/.envrc b/.envrc index cce3aa58..e1d415a5 100644 --- a/.envrc +++ b/.envrc @@ -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 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..18f6c7e9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +pixi.lock linguist-language=YAML linguist-generated=true diff --git a/.gitignore b/.gitignore index 86b251c6..2b89bbba 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ typings/ # Virtual environments *venv/ +.pixi/ .tox/ pyvenv*/ diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index 2e3ec8ef..00000000 --- a/.gitpod.yml +++ /dev/null @@ -1,36 +0,0 @@ -tasks: - - init: pyenv local 3.9 - - init: pip install -c .constraints/py3.9.txt -e .[dev] - -github: - prebuilds: - master: true - branches: false - pullRequests: true - pullRequestsFromForks: true - addComment: false - addBadge: false - addLabel: false - -vscode: - extensions: - - charliermarsh.ruff - - eamodio.gitlens - - editorconfig.editorconfig - - esbenp.prettier-vscode - - executablebookproject.myst-highlight - - github.vscode-github-actions - - github.vscode-pull-request-github - - ms-python.python - - ms-python.mypy-type-checker - - ms-python.vscode-pylance - - ms-toolsai.vscode-jupyter-cell-tags - - ms-vscode.live-server - - ms-vsliveshare.vsliveshare - - oijaz.unicode-latex - - redhat.vscode-yaml - - soulcode.vscode-unwanted-extensions - - stkb.rewrap - - streetsidesoftware.code-spell-checker - - tamasfe.even-better-toml - - yzhang.markdown-all-in-one diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 77b78933..92afb790 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,9 +3,7 @@ ci: autoupdate_schedule: quarterly # already done by requirements-cron.yml skip: - mypy - - prettier - pyright - - taplo repos: - repo: meta @@ -13,15 +11,29 @@ repos: - 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 @@ -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: diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d528453c..dd8bb212 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -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", diff --git a/.vscode/settings.json b/.vscode/settings.json index 54d6a8cc..8d5bc234 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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"], diff --git a/README.md b/README.md index 823e1ec2..b5acac33 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/index.md b/docs/index.md index 17defe25..9f4be504 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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 diff --git a/environment.yml b/environment.yml index ec90afd9..d262623b 100644 --- a/environment.yml +++ b/environment.yml @@ -8,5 +8,4 @@ dependencies: - pip: - -c .constraints/py3.9.txt -e .[dev] variables: - PRETTIER_LEGACY_CLI: "1" PYTHONHASHSEED: 0 diff --git a/pyproject.toml b/pyproject.toml index 08cd339c..bda60e72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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] @@ -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 @@ -221,7 +320,6 @@ src = [ "src", "tests", ] -target-version = "py38" [tool.ruff.format] docstring-code-format = true @@ -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