From c9167daefb910c537c81589e440cb2b8ff3698c1 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:47:31 +0100 Subject: [PATCH] FIX: define dev dependencies as dependency groups (#24) * DX: disable Sphinx warnings in `linkcheck` job * DX: run `pyright` in `tox -e sty` job * MAINT: remove redundant `types` dependency group * MAINT: update lock files * MAINT: update links to TRs --- .binder/postBuild | 5 +- .github/workflows/ci.yml | 4 +- .pre-commit-config.yaml | 4 +- .readthedocs.yml | 3 +- CONTRIBUTING.md | 2 +- docs/033/index.ipynb | 2 +- pixi.lock | 42 ++++++------- pyproject.toml | 57 ++++++++--------- uv.lock | 129 ++++++++++++++++++++++++--------------- 9 files changed, 138 insertions(+), 110 deletions(-) diff --git a/.binder/postBuild b/.binder/postBuild index c8dc1b4..079abb3 100755 --- a/.binder/postBuild +++ b/.binder/postBuild @@ -11,8 +11,9 @@ export PYTHONHASHSEED="0" pixi clean cache --yes uv export \ - --extra jupyter \ - --extra notebooks \ + --group jupyter \ + --group notebooks \ + --no-dev \ > requirements.txt uv pip install \ --requirement requirements.txt \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1920091..2c925fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ on: jobs: doc: - uses: ComPWA/actions/.github/workflows/ci-docs.yml@v2 + uses: ComPWA/actions/.github/workflows/ci-docs.yml@v2.1 permissions: pages: write id-token: write @@ -39,4 +39,4 @@ jobs: if: inputs.specific-pip-packages == '' secrets: token: ${{ secrets.PAT }} - uses: ComPWA/actions/.github/workflows/pre-commit.yml@v2 + uses: ComPWA/actions/.github/workflows/pre-commit.yml@v2.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 820c9a6..ee6624d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - id: check-useless-excludes - repo: https://github.com/ComPWA/policy - rev: 0.5.3 + rev: 0.5.5 hooks: - id: check-dev-files args: @@ -152,6 +152,6 @@ repos: - id: pyright - repo: https://github.com/astral-sh/uv-pre-commit - rev: 0.4.26 + rev: 0.4.28 hooks: - id: uv-lock diff --git a/.readthedocs.yml b/.readthedocs.yml index c1d08b3..893cf79 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -11,8 +11,9 @@ build: export UV_LINK_MODE=copy pixi run \ uv run \ - --extra doc \ + --group doc \ --locked \ + --no-dev \ --with tox \ tox -e doc mkdir -p $READTHEDOCS_OUTPUT diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80210d0..a3943ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ cd report Now it's simply a matter of creating and activating the [virtual environment](https://docs.astral.sh/uv/pip/environments) with [`uv sync`](https://docs.astral.sh/uv/reference/cli/#uv-sync). The dependencies for the project are 'pinned' in each commit through the [`uv.lock` file](https://docs.astral.sh/uv/concepts/projects/#project-lockfile). ```shell -uv sync +uv sync --all-extras source .venv/bin/activate ``` diff --git a/docs/033/index.ipynb b/docs/033/index.ipynb index ca8efbd..a67324b 100644 --- a/docs/033/index.ipynb +++ b/docs/033/index.ipynb @@ -1224,7 +1224,7 @@ "metadata": {}, "source": [ ":::{seealso}\n", - "- [Section of helicity formalism in **TR-015** (Spin alignment implementation)](https://compwa.github.io/report/015.html#helicity-formalism)\n", + "- [Section of helicity formalism in **TR-015** (Spin alignment implementation)](../015/index.ipynb#helicity-formalism)\n", "- [Helicity versus canonical in Ampform](https://ampform.readthedocs.io/stable/usage/helicity/formalism.html)\n", ":::" ] diff --git a/pixi.lock b/pixi.lock index 4b57568..a46857f 100644 --- a/pixi.lock +++ b/pixi.lock @@ -54,7 +54,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.44-hba22ea6_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pixman-0.43.2-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pthread-stubs-0.4-hb9d3cd8_1002.conda - - conda: https://conda.anaconda.org/conda-forge/linux-64/uv-0.4.26-h0f3a69f_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/uv-0.4.27-h0f3a69f_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libice-1.1.1-hb9d3cd8_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libsm-1.2.4-he73a12e_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/xorg-libx11-1.8.10-h4f16b4b_0.conda @@ -107,7 +107,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-64/pango-1.54.0-h115fe74_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/pcre2-10.44-h7634a1b_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/pixman-0.43.4-h73e2aa4_0.conda - - conda: https://conda.anaconda.org/conda-forge/osx-64/uv-0.4.26-h3a35632_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-64/uv-0.4.27-h3a35632_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/xz-5.2.6-h775f41a_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-64/zlib-1.3.1-hd23fc13_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/zstd-1.5.6-h915ae27_0.conda @@ -152,7 +152,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pango-1.54.0-h9ee27a3_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pcre2-10.44-h297a79d_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pixman-0.43.4-hebf3989_0.conda - - conda: https://conda.anaconda.org/conda-forge/osx-arm64/uv-0.4.26-h41fe3af_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/uv-0.4.27-h41fe3af_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/xz-5.2.6-h57fd34a_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/zlib-1.3.1-h8359307_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/zstd-1.5.6-hb46c0d2_0.conda @@ -2149,12 +2149,12 @@ packages: timestamp: 1726802366959 - kind: conda name: uv - version: 0.4.26 + version: 0.4.27 build: h0f3a69f_0 subdir: linux-64 - url: https://conda.anaconda.org/conda-forge/linux-64/uv-0.4.26-h0f3a69f_0.conda - sha256: 4f05a61c3c3127ce7e487001215d20f49da0563fa4335462b2f6cc0028bb265b - md5: c4316a4c2b47ae154259fa5caffd53f1 + url: https://conda.anaconda.org/conda-forge/linux-64/uv-0.4.27-h0f3a69f_0.conda + sha256: ff3a99a3e9009d38342279e36a3978c1c8be91f5c987417627208efb9a24ef13 + md5: f782367ea486b53fe1fe387c94978d3c depends: - __glibc >=2.17,<3.0.a0 - libgcc >=13 @@ -2162,40 +2162,40 @@ packages: constrains: - __glibc >=2.17 license: Apache-2.0 OR MIT - size: 9446110 - timestamp: 1729774270770 + size: 9632075 + timestamp: 1729898873130 - kind: conda name: uv - version: 0.4.26 + version: 0.4.27 build: h3a35632_0 subdir: osx-64 - url: https://conda.anaconda.org/conda-forge/osx-64/uv-0.4.26-h3a35632_0.conda - sha256: 8f594947428100e911c824d2cf4dc635a05b680e96dad482761ddf102186d217 - md5: f69ba31bab2be7f8e7456647aaf3a672 + url: https://conda.anaconda.org/conda-forge/osx-64/uv-0.4.27-h3a35632_0.conda + sha256: 119e3f21ed86316c56504b0f0feb2529f1651d4faac2bccc0f8b58a823c710d7 + md5: 31b140191c0a8469e7360db888f0d0fa depends: - __osx >=10.13 - libcxx >=17 constrains: - __osx >=10.13 license: Apache-2.0 OR MIT - size: 9135732 - timestamp: 1729774740925 + size: 9227634 + timestamp: 1729899302713 - kind: conda name: uv - version: 0.4.26 + version: 0.4.27 build: h41fe3af_0 subdir: osx-arm64 - url: https://conda.anaconda.org/conda-forge/osx-arm64/uv-0.4.26-h41fe3af_0.conda - sha256: f9530088e0a7319946c0dbc51c2e82bfa964fa3cb548e986053c7d8b6698056d - md5: 8beaeac747a7887e458e7de7e3d9fd6d + url: https://conda.anaconda.org/conda-forge/osx-arm64/uv-0.4.27-h41fe3af_0.conda + sha256: 67f547c15c4417fdfec1cc2e0c0f4855f3a60868d2cd103a59515af716a25a09 + md5: 0949ae4363d3ab9da8fbdc8cea421689 depends: - __osx >=11.0 - libcxx >=17 constrains: - __osx >=11.0 license: Apache-2.0 OR MIT - size: 8421278 - timestamp: 1729775629422 + size: 8559573 + timestamp: 1729899647287 - kind: conda name: xorg-libice version: 1.1.1 diff --git a/pyproject.toml b/pyproject.toml index 33f8938..ac31cf7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,16 +14,25 @@ maintainers = [{email = "compwa-admin@ep1.rub.de"}] name = "compwa-report" requires-python = ">=3.9" -[project.optional-dependencies] +[project.readme] +content-type = "text/markdown" +file = "README.md" + +[project.urls] +Documentation = "https://compwa.github.io/report" +Source = "https://github.com/ComPWA/report" +Tracker = "https://github.com/ComPWA/report/issues" + +[dependency-groups] dev = [ - "compwa-report[doc]", - "compwa-report[jupyter]", - "compwa-report[sty]", - "compwa-report[test]", + "ruff", "sphinx-autobuild", + {include-group = "doc"}, + {include-group = "jupyter"}, + {include-group = "style"}, + {include-group = "test"}, ] doc = [ - "compwa-report[notebooks]", "myst-nb", "nbformat", "sphinx", @@ -39,42 +48,28 @@ doc = [ "sphinx-thebe", "sphinx-togglebutton", "sphinxcontrib-bibtex >=2", + {include-group = "notebooks"}, ] jupyter = [ - "compwa-report[notebooks]", "jupyterlab", - "jupyterlab-code-formatter >=3.0.0", + "jupyterlab-code-formatter", "jupyterlab-git", "jupyterlab-lsp", "jupyterlab-myst", "python-lsp-ruff", "python-lsp-server[rope]", + {include-group = "notebooks"}, ] -notebooks = [ - "pyproject-local-kernel", -] -sty = [ - "compwa-report[types]", - "ruff", +notebooks = ["pyproject-local-kernel"] +style = [ + "nbformat", + "sphinx-api-relink", ] test = [ - "compwa-report[notebooks]", "nbmake", "pytest-env", + {include-group = "notebooks"}, ] -types = [ - "nbformat", - "sphinx-api-relink", -] - -[project.readme] -content-type = "text/markdown" -file = "README.md" - -[project.urls] -Documentation = "https://compwa.github.io/report" -Source = "https://github.com/ComPWA/report" -Tracker = "https://github.com/ComPWA/report/issues" [tool.setuptools] include-package-data = false @@ -124,6 +119,8 @@ reportUnusedFunction = true reportUnusedImport = true reportUnusedVariable = true typeCheckingMode = "strict" +venv = ".venv" +venvPath = "." [tool.pytest.ini_options] addopts = [ @@ -348,6 +345,8 @@ commands = --show-traceback \ docs/ docs/_build/linkcheck description = Check external links in the documentation (requires internet connection) +setenv = + PYTHONWARNINGS = [testenv:nb] allowlist_externals = @@ -362,6 +361,4 @@ allowlist_externals = commands = pre-commit run --all-files {posargs} description = Perform all linting, formatting, and spelling checks -setenv = - SKIP = pyright """ diff --git a/uv.lock b/uv.lock index 26e600c..a76c474 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,9 @@ version = 1 requires-python = ">=3.9" +resolution-markers = [ + "python_full_version < '3.12'", + "python_full_version >= '3.12'", +] [[package]] name = "accessible-pygments" @@ -373,7 +377,7 @@ name = "compwa-report" version = "0.0" source = { editable = "." } -[package.optional-dependencies] +[package.dev-dependencies] dev = [ { name = "jupyterlab" }, { name = "jupyterlab-code-formatter" }, @@ -434,9 +438,8 @@ jupyter = [ notebooks = [ { name = "pyproject-local-kernel" }, ] -sty = [ +style = [ { name = "nbformat" }, - { name = "ruff" }, { name = "sphinx-api-relink" }, ] test = [ @@ -444,50 +447,76 @@ test = [ { name = "pyproject-local-kernel" }, { name = "pytest-env" }, ] -types = [ + +[package.metadata] + +[package.metadata.requires-dev] +dev = [ + { name = "jupyterlab" }, + { name = "jupyterlab-code-formatter" }, + { name = "jupyterlab-git" }, + { name = "jupyterlab-lsp" }, + { name = "jupyterlab-myst" }, + { name = "myst-nb" }, { name = "nbformat" }, + { name = "nbmake" }, + { name = "pyproject-local-kernel" }, + { name = "pytest-env" }, + { name = "python-lsp-ruff" }, + { name = "python-lsp-server", extras = ["rope"] }, + { name = "ruff" }, + { name = "sphinx" }, { name = "sphinx-api-relink" }, + { name = "sphinx-autobuild" }, + { name = "sphinx-book-theme" }, + { name = "sphinx-codeautolink", extras = ["ipython"] }, + { name = "sphinx-comments" }, + { name = "sphinx-copybutton" }, + { name = "sphinx-design" }, + { name = "sphinx-hep-pdgref" }, + { name = "sphinx-pybtex-etal-style" }, + { name = "sphinx-remove-toctrees" }, + { name = "sphinx-thebe" }, + { name = "sphinx-togglebutton" }, + { name = "sphinxcontrib-bibtex", specifier = ">=2" }, ] - -[package.metadata] -requires-dist = [ - { name = "compwa-report", extras = ["doc"], marker = "extra == 'dev'" }, - { name = "compwa-report", extras = ["jupyter"], marker = "extra == 'dev'" }, - { name = "compwa-report", extras = ["notebooks"], marker = "extra == 'doc'" }, - { name = "compwa-report", extras = ["notebooks"], marker = "extra == 'jupyter'" }, - { name = "compwa-report", extras = ["notebooks"], marker = "extra == 'test'" }, - { name = "compwa-report", extras = ["sty"], marker = "extra == 'dev'" }, - { name = "compwa-report", extras = ["test"], marker = "extra == 'dev'" }, - { name = "compwa-report", extras = ["types"], marker = "extra == 'sty'" }, - { name = "jupyterlab", marker = "extra == 'jupyter'" }, - { name = "jupyterlab-code-formatter", marker = "extra == 'jupyter'", specifier = ">=3.0.0" }, - { name = "jupyterlab-git", marker = "extra == 'jupyter'" }, - { name = "jupyterlab-lsp", marker = "extra == 'jupyter'" }, - { name = "jupyterlab-myst", marker = "extra == 'jupyter'" }, - { name = "myst-nb", marker = "extra == 'doc'" }, - { name = "nbformat", marker = "extra == 'doc'" }, - { name = "nbformat", marker = "extra == 'types'" }, - { name = "nbmake", marker = "extra == 'test'" }, - { name = "pyproject-local-kernel", marker = "extra == 'notebooks'" }, - { name = "pytest-env", marker = "extra == 'test'" }, - { name = "python-lsp-ruff", marker = "extra == 'jupyter'" }, - { name = "python-lsp-server", extras = ["rope"], marker = "extra == 'jupyter'" }, - { name = "ruff", marker = "extra == 'sty'" }, - { name = "sphinx", marker = "extra == 'doc'" }, - { name = "sphinx-api-relink", marker = "extra == 'doc'" }, - { name = "sphinx-api-relink", marker = "extra == 'types'" }, - { name = "sphinx-autobuild", marker = "extra == 'dev'" }, - { name = "sphinx-book-theme", marker = "extra == 'doc'" }, - { name = "sphinx-codeautolink", extras = ["ipython"], marker = "extra == 'doc'" }, - { name = "sphinx-comments", marker = "extra == 'doc'" }, - { name = "sphinx-copybutton", marker = "extra == 'doc'" }, - { name = "sphinx-design", marker = "extra == 'doc'" }, - { name = "sphinx-hep-pdgref", marker = "extra == 'doc'" }, - { name = "sphinx-pybtex-etal-style", marker = "extra == 'doc'" }, - { name = "sphinx-remove-toctrees", marker = "extra == 'doc'" }, - { name = "sphinx-thebe", marker = "extra == 'doc'" }, - { name = "sphinx-togglebutton", marker = "extra == 'doc'" }, - { name = "sphinxcontrib-bibtex", marker = "extra == 'doc'", specifier = ">=2" }, +doc = [ + { name = "myst-nb" }, + { name = "nbformat" }, + { name = "pyproject-local-kernel" }, + { name = "sphinx" }, + { name = "sphinx-api-relink" }, + { name = "sphinx-book-theme" }, + { name = "sphinx-codeautolink", extras = ["ipython"] }, + { name = "sphinx-comments" }, + { name = "sphinx-copybutton" }, + { name = "sphinx-design" }, + { name = "sphinx-hep-pdgref" }, + { name = "sphinx-pybtex-etal-style" }, + { name = "sphinx-remove-toctrees" }, + { name = "sphinx-thebe" }, + { name = "sphinx-togglebutton" }, + { name = "sphinxcontrib-bibtex", specifier = ">=2" }, +] +jupyter = [ + { name = "jupyterlab" }, + { name = "jupyterlab-code-formatter" }, + { name = "jupyterlab-git" }, + { name = "jupyterlab-lsp" }, + { name = "jupyterlab-myst" }, + { name = "pyproject-local-kernel" }, + { name = "python-lsp-ruff" }, + { name = "python-lsp-server", extras = ["rope"] }, +] +notebooks = [{ name = "pyproject-local-kernel" }] +style = [ + { name = "nbformat" }, + { name = "sphinx-api-relink" }, +] +test = [ + { name = "nbmake" }, + { name = "pyproject-local-kernel" }, + { name = "pytest-env" }, ] [[package]] @@ -1618,16 +1647,16 @@ wheels = [ [[package]] name = "pyproject-local-kernel" -version = "0.12.0" +version = "0.12.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "jupyter-client" }, { name = "tomli", marker = "python_full_version < '3.11'" }, { name = "traitlets" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/a3/02/21e10d19c93e1f142cfced918ff95809da61e5bb7bc3631e5b0c53cb73c9/pyproject_local_kernel-0.12.0.tar.gz", hash = "sha256:7ae2b4a8caea45de457e023fa490ffc955e7d033fe7f5c17bea23b215fba4c1a", size = 311620 } +sdist = { url = "https://files.pythonhosted.org/packages/40/fb/94358922dd72d940b1a10e6cdcb11b97d9f39f9212717b8cce32f7f00a15/pyproject_local_kernel-0.12.1.tar.gz", hash = "sha256:a983a370a4c8b29acfbcc4ccda22d13215c97f24e2b51d980830fa7d5d37fcc5", size = 331109 } wheels = [ - { url = "https://files.pythonhosted.org/packages/e1/a9/4739ce2dbc2bd680c8d294cdf347758eb6a56c3365d1ef3913ed711a7f8d/pyproject_local_kernel-0.12.0-py3-none-any.whl", hash = "sha256:a4311fe25085682b8ae4f58fce8e18ef422266f605ab2a6945815e854c95f7f8", size = 19253 }, + { url = "https://files.pythonhosted.org/packages/a7/17/f2b6d2c93896d19bfe53bea78a23bf65e5b8f36890dd2dc4d9fc56d49e60/pyproject_local_kernel-0.12.1-py3-none-any.whl", hash = "sha256:ed788fa70864c4635ff65a4414739cc247a7908a9d9b3543e705514d1b98dce2", size = 19236 }, ] [[package]] @@ -2504,15 +2533,15 @@ wheels = [ [[package]] name = "starlette" -version = "0.41.0" +version = "0.41.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, { name = "typing-extensions", marker = "python_full_version < '3.10'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/78/53/c3a36690a923706e7ac841f649c64f5108889ab1ec44218dac45771f252a/starlette-0.41.0.tar.gz", hash = "sha256:39cbd8768b107d68bfe1ff1672b38a2c38b49777de46d2a592841d58e3bf7c2a", size = 2573755 } +sdist = { url = "https://files.pythonhosted.org/packages/3e/da/1fb4bdb72ae12b834becd7e1e7e47001d32f91ec0ce8d7bc1b618d9f0bd9/starlette-0.41.2.tar.gz", hash = "sha256:9834fd799d1a87fd346deb76158668cfa0b0d56f85caefe8268e2d97c3468b62", size = 2573867 } wheels = [ - { url = "https://files.pythonhosted.org/packages/35/c6/a4443bfabf5629129512ca0e07866c4c3c094079ba4e9b2551006927253c/starlette-0.41.0-py3-none-any.whl", hash = "sha256:a0193a3c413ebc9c78bff1c3546a45bb8c8bcb4a84cae8747d650a65bd37210a", size = 73216 }, + { url = "https://files.pythonhosted.org/packages/54/43/f185bfd0ca1d213beb4293bed51d92254df23d8ceaf6c0e17146d508a776/starlette-0.41.2-py3-none-any.whl", hash = "sha256:fbc189474b4731cf30fcef52f18a8d070e3f3b46c6a04c97579e85e6ffca942d", size = 73259 }, ] [[package]]