From e62ffdb1d2f5bbc8aaa8f7fe6c5db3a4261c99f7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 20:00:16 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/lock.yml | 2 +- CONTRIBUTING.md | 20 +++++++++++++++++++- docs/001/index.ipynb | 3 +-- docs/028/index.ipynb | 2 +- docs/030/index.ipynb | 6 +++--- docs/031/index.ipynb | 2 +- docs/032/index.ipynb | 10 +++++----- pixi.toml | 21 +++++++++++++++++++++ 8 files changed, 52 insertions(+), 14 deletions(-) diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index f5f2781..583333d 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -12,7 +12,7 @@ on: - epic/* paths: - .pre-commit-config.yaml - - "**/Manifest.toml" + - Manifest.toml - pixi.lock - uv.lock workflow_dispatch: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad8eac0..80210d0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,8 +19,26 @@ uv sync source .venv/bin/activate ``` -Formatting and linting checks are automatically performed when committing changes. This is done with [pre-commit](https://pre-commit.com). To install the hooks in your local repository, run [`pre-commit install`](https://pre-commit.com/#3-install-the-git-hook-scripts) **once**: +Formatting and linting checks are automatically performed when committing changes. This is done with [pre-commit](https://pre-commit.com). To install the hooks in your local repository, run install `pre-commit` with `uv`: + +```shell +uv tool install pre-commit --with pre-commit-uv --force-reinstall +``` + +and [`pre-commit install`](https://pre-commit.com/#3-install-the-git-hook-scripts) **once**: ```shell pre-commit install --install-hooks ``` + +In addition, it may be handy to install `tox`: + +```shell +uv tool install tox --with tox-uv +``` + +If the repository provides a Tox configuration under [`pyproject.toml`](./pyproject.toml), you can see which jobs it defines with: + +```shell +tox list +``` diff --git a/docs/001/index.ipynb b/docs/001/index.ipynb index 5fec4cf..72489fe 100644 --- a/docs/001/index.ipynb +++ b/docs/001/index.ipynb @@ -433,8 +433,7 @@ " arg = expr.args[0]\n", " x = self._print(arg)\n", " return (\n", - " f\"select([less({x}, 0), True], [1j * sqrt(-{x}), sqrt({x})],\"\n", - " \" default=nan,)\"\n", + " f\"select([less({x}, 0), True], [1j * sqrt(-{x}), sqrt({x})], default=nan,)\"\n", " )" ] }, diff --git a/docs/028/index.ipynb b/docs/028/index.ipynb index 41197a6..72b0f1b 100644 --- a/docs/028/index.ipynb +++ b/docs/028/index.ipynb @@ -378,7 +378,7 @@ " except (PdgAmbiguousValueError, PdgNoDataError):\n", " pass\n", " else:\n", - " print(f\"{initial_state:>20} → {\" \".join(final_state)}\")" + " print(f\"{initial_state:>20} → {' '.join(final_state)}\")" ] }, { diff --git a/docs/030/index.ipynb b/docs/030/index.ipynb index 8f5bb7d..699b904 100644 --- a/docs/030/index.ipynb +++ b/docs/030/index.ipynb @@ -983,7 +983,7 @@ " coupling_pattern: str,\n", "):\n", " original_parameters = dict(func.parameters)\n", - " negative_lookahead = f\"(?!{\"|\".join(map(re.escape, resonances))})\"\n", + " negative_lookahead = f\"(?!{'|'.join(map(re.escape, resonances))})\"\n", " # https://regex101.com/r/WrgGyD/1\n", " pattern = rf\"^{coupling_pattern}({negative_lookahead}.)*$\"\n", " set_parameters_to_zero(func, pattern)\n", @@ -1274,7 +1274,7 @@ "\n", " ax1.legend(loc=\"upper left\")\n", "\n", - " output_file = f\"argand-{title.lower().replace(\" \", \"-\")}.svg\"\n", + " output_file = f\"argand-{title.lower().replace(' ', '-')}.svg\"\n", " fig.savefig(output_file, bbox_inches=\"tight\")\n", " fig.show()" ] @@ -1443,7 +1443,7 @@ " fig.legend(bbox_to_anchor=(0.1, 0.9), loc=\"upper left\")\n", " fig.tight_layout()\n", "\n", - " output_file = f\"phase-{title.lower().replace(\" \", \"-\")}.svg\"\n", + " output_file = f\"phase-{title.lower().replace(' ', '-')}.svg\"\n", " fig.savefig(output_file, bbox_inches=\"tight\")\n", " fig.show()" ] diff --git a/docs/031/index.ipynb b/docs/031/index.ipynb index 7a50175..69af55c 100644 --- a/docs/031/index.ipynb +++ b/docs/031/index.ipynb @@ -885,7 +885,7 @@ " coupling_pattern: str,\n", "):\n", " original_parameters = dict(func.parameters)\n", - " negative_lookahead = f\"(?!{\"|\".join(map(re.escape, resonances))})\"\n", + " negative_lookahead = f\"(?!{'|'.join(map(re.escape, resonances))})\"\n", " # https://regex101.com/r/WrgGyD/1\n", " pattern = rf\"^{coupling_pattern}({negative_lookahead}.)*$\"\n", " set_parameters_to_zero(func, pattern)\n", diff --git a/docs/032/index.ipynb b/docs/032/index.ipynb index 42f2792..689a941 100644 --- a/docs/032/index.ipynb +++ b/docs/032/index.ipynb @@ -1056,7 +1056,7 @@ " m_thr = sum(p.mass for p in decay.children)\n", " label = None\n", " if set_labels:\n", - " label = f\"${\"+\".join(f\"m_{{{p.latex}}}\" for p in decay.children)}$\"\n", + " label = f\"${'+'.join(f'm_{{{p.latex}}}' for p in decay.children)}$\"\n", " ax.axvline(m_thr, c=f\"C{i}\", label=label, ls=\"dotted\")" ] }, @@ -1101,7 +1101,7 @@ " alpha=0.5,\n", " bins=200,\n", " density=True,\n", - " label=f\"${\" \".join(p.latex for p in DECAYS[i].children)}$\",\n", + " label=f\"${' '.join(p.latex for p in DECAYS[i].children)}$\",\n", " ax=ax,\n", " )\n", "indicate_thresholds(ax)\n", @@ -1174,7 +1174,7 @@ " alpha=0.5,\n", " bins=200,\n", " density=True,\n", - " label=f\"${\" \".join(p.latex for p in DECAYS[i].children)}$\",\n", + " label=f\"${' '.join(p.latex for p in DECAYS[i].children)}$\",\n", " ax=ax,\n", " )\n", "indicate_thresholds(ax)\n", @@ -1285,7 +1285,7 @@ " fig.legend()\n", " fig.tight_layout()\n", "\n", - " output_file = f\"{title.lower().replace(\" \", \"-\")}.svg\"\n", + " output_file = f\"{title.lower().replace(' ', '-')}.svg\"\n", " fig.savefig(output_file, bbox_inches=\"tight\")\n", " fig.show()\n", "\n", @@ -1306,7 +1306,7 @@ " bins=bins,\n", " color=color,\n", " density=True,\n", - " label=f\"Data ${\" \".join(p.latex for p in DECAYS[decay_id].children)}$\",\n", + " label=f\"Data ${' '.join(p.latex for p in DECAYS[decay_id].children)}$\",\n", " ax=ax,\n", " )\n", " fast_histogram(\n", diff --git a/pixi.toml b/pixi.toml index 06c72bb..4d30e44 100644 --- a/pixi.toml +++ b/pixi.toml @@ -17,3 +17,24 @@ env = {PYTHONHASHSEED = "0"} graphviz = "*" julia = {channel = "https://repo.prefix.dev/julia-forge", version = "*"} uv = "*" + +[feature.dev.tasks.ci] +depends_on = ["doc", "linkcheck", "sty"] + +[feature.dev.tasks.doc] +cmd = "sphinx-build --builder=html --fail-on-warning --keep-going --show-traceback docs/ docs/_build/html" +env = {PYTHONWARNINGS = "", TF_CPP_MIN_LOG_LEVEL = "3", ZFIT_DISABLE_TF_WARNINGS = "1"} + +[feature.dev.tasks.doclive] +cmd = "sphinx-autobuild --ignore=docs/_build/ --ignore=docs/_static/exported_intensity_model.py --open-browser --port=0 --re-ignore='.*/__pycache__/.*' --re-ignore='.*/.ipynb_checkpoints/.*' --re-ignore='.*/.virtual_documents/.*' --re-ignore='.*\\.csv' --re-ignore='.*\\.gif' --re-ignore='.*\\.gitignore' --re-ignore='.*\\.gv' --re-ignore='.*\\.inv' --re-ignore='.*\\.json' --re-ignore='.*\\.pickle' --re-ignore='.*\\.png' --re-ignore='.*\\.svg' --re-ignore='.*\\.yaml' --re-ignore='.*\\.yml' --watch docs docs/ docs/_build/html" +env = {PYTHONWARNINGS = "", ZFIT_DISABLE_TF_WARNINGS = "1"} + +[feature.dev.tasks.linkcheck] +cmd = "sphinx-build --builder=linkcheck --show-traceback docs/ docs/_build/linkcheck" + +[feature.dev.tasks.nb] +cmd = "pytest docs" + +[feature.dev.tasks.sty] +cmd = "pre-commit run --all-files" +env = {SKIP = "pyright"}