Skip to content

Commit

Permalink
FIX: define dev dependencies as dependency groups (#229)
Browse files Browse the repository at this point in the history
* DX: define `notebooks` dependency group
* DX: move `ruff` to `dev` dependencies
* MAINT: update lock files
  • Loading branch information
redeboer authored Oct 29, 2024
1 parent 7436911 commit c081f0d
Show file tree
Hide file tree
Showing 7 changed files with 218 additions and 247 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ 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
with:
specific-pip-packages: ${{ inputs.specific-pip-packages }}
pytest:
uses: ComPWA/actions/.github/workflows/pytest.yml@v2
uses: ComPWA/actions/.github/workflows/pytest.yml@v2.1
with:
coverage-target: pwa_pages
skipped-python-versions: all
Expand All @@ -44,4 +44,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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 0.5.0
rev: 0.5.5
hooks:
- id: check-dev-files
args:
Expand Down Expand Up @@ -59,7 +59,7 @@ repos:
metadata.vscode
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
rev: v0.7.1
hooks:
- id: ruff
args: [--fix]
Expand Down Expand Up @@ -145,7 +145,7 @@ repos:
- python

- repo: https://github.com/ComPWA/pyright-pre-commit
rev: v1.1.385
rev: v1.1.386
hooks:
- id: pyright

Expand All @@ -159,6 +159,6 @@ repos:
files: (docs/software/.*\.json|src/pwa_pages/project_inventory.py)

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.4.25
rev: 0.4.28
hooks:
- id: uv-lock
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ build:
pixi global install graphviz uv
- |-
export UV_LINK_MODE=copy
uv run --extra doc --locked --with tox \
uv run \
--group doc \
--locked \
--no-dev \
--with tox \
tox -e doc
mkdir -p $READTHEDOCS_OUTPUT
mv docs/_build/html $READTHEDOCS_OUTPUT
22 changes: 20 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,30 @@ cd PWA-pages
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
```

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
```
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@
}
html_title = "Partial Wave Analysis"
intersphinx_mapping = {
"IPython": (f"https://ipython.readthedocs.io/en/{pin("IPython")}", None),
"matplotlib": (f"https://matplotlib.org/{pin("matplotlib")}", None),
"IPython": (f"https://ipython.readthedocs.io/en/{pin('IPython')}", None),
"matplotlib": (f"https://matplotlib.org/{pin('matplotlib')}", None),
"python": ("https://docs.python.org/3", None),
"pydantic": (f"https://docs.pydantic.dev/{pin_minor("pydantic")}", None),
"pydantic": (f"https://docs.pydantic.dev/{pin_minor('pydantic')}", None),
"sympy": ("https://docs.sympy.org/latest", None),
}
linkcheck_anchors = False
Expand Down
61 changes: 31 additions & 30 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,30 @@ name = "pwa-pages"
requires-python = ">=3.12"
version = "0.0.0"

[project.optional-dependencies]
[project.readme]
content-type = "text/markdown"
file = "README.md"

[project.scripts]
export-json-schema = "pwa_pages.project_inventory:export_json_schema"

[project.urls]
Changelog = "https://github.com/ComPWA/PWA-pages/releases"
Documentation = "https://pwa.rtfd.io"
Source = "https://github.com/ComPWA/PWA-pages"
Tracker = "https://github.com/ComPWA/PWA-pages/issues"

[dependency-groups]
dev = [
"pwa-pages[doc]",
"pwa-pages[jupyter]",
"pwa-pages[sty]",
"pwa-pages[test]",
"nbmake",
"ruff",
"sphinx-autobuild",
{include-group = "doc"},
{include-group = "jupyter"},
{include-group = "style"},
{include-group = "test"},
]
doc = [
"feynman",
"ipywidgets",
"jupyter",
"matplotlib",
"myst-nb",
"sphinx",
"sphinx-api-relink",
Expand All @@ -54,26 +65,29 @@ doc = [
"sphinx-pybtex-etal-style",
"sphinx-thebe",
"sphinx-togglebutton",
"sphinxcontrib-bibtex >=2.2", # bibtex_reference_style
"sympy",
"sphinxcontrib-bibtex >=2.2",
{include-group = "notebooks"},
]
jupyter = [
"jupyterlab",
"jupyterlab-code-formatter >=3.0.0",
"jupyterlab-code-formatter",
"jupyterlab-git",
"jupyterlab-lsp",
"jupyterlab-myst",
"pwa-pages[doc]",
"python-lsp-ruff",
"python-lsp-server[rope]",
{include-group = "notebooks"},
]
sty = [
notebooks = [
"feynman",
"matplotlib",
"sympy",
]
style = [
"mypy",
"pwa-pages[types]",
"ruff",
{include-group = "types"},
]
test = [
"nbmake",
"pytest",
"pytest-cov",
"pytest-xdist",
Expand All @@ -87,19 +101,6 @@ types = [
"types-setuptools",
]

[project.readme]
content-type = "text/markdown"
file = "README.md"

[project.scripts]
export-json-schema = "pwa_pages.project_inventory:export_json_schema"

[project.urls]
Changelog = "https://github.com/ComPWA/PWA-pages/releases"
Documentation = "https://pwa.rtfd.io"
Source = "https://github.com/ComPWA/PWA-pages"
Tracker = "https://github.com/ComPWA/PWA-pages/issues"

[tool.setuptools]
include-package-data = false
package-dir = {"" = "src"}
Expand Down
Loading

0 comments on commit c081f0d

Please sign in to comment.