Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: define dev dependencies as dependency groups #43

Merged
merged 6 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@
"pyproject.toml"
],
"language": "en-US",
"words": ["ComPWA", "conda", "doctests", "pdgref", "PyPA", "pytest"],
"words": [
"ComPWA",
"conda",
"doctests",
"pdgref",
"PyPA",
"pyproject",
"pytest"
],
"ignoreWords": [
"MAINT",
"PYTHONHASHSEED",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ on:

jobs:
pytest:
uses: ComPWA/actions/.github/workflows/pytest.yml@v2
uses: ComPWA/actions/.github/workflows/pytest.yml@v2.1
with:
coverage-target: sphinx_hep_pdgref
macos-python-version: "3.9"
Expand All @@ -37,4 +37,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 @@ -12,14 +12,14 @@ 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:
- --repo-name=sphinx-hep-pdgref

- 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 @@ -71,7 +71,7 @@ repos:
- --in-place

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.15.1
rev: v8.15.2
hooks:
- id: cspell

Expand All @@ -96,6 +96,6 @@ repos:
- python

- repo: https://github.com/ComPWA/pyright-pre-commit
rev: v1.1.385
rev: v1.1.386
hooks:
- id: pyright
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 sphinx-hep-pdgref
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
```
56 changes: 24 additions & 32 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,6 @@ maintainers = [{email = "[email protected]"}]
name = "sphinx-hep-pdgref"
requires-python = ">=3.9"

[project.optional-dependencies]
dev = [
"sphinx-hep-pdgref[sty]",
"sphinx-hep-pdgref[test]",
"tox >=1.9", # for skip_install, use_develop
]
lint = [
"ruff",
"sphinx-hep-pdgref[mypy]",
]
mypy = [
"mypy >=0.730", # attrs and error code support
"types-docutils",
"types-setuptools",
]
sty = [
"pre-commit-uv",
"ruff",
"sphinx-hep-pdgref[format]",
"sphinx-hep-pdgref[lint]",
"sphinx-hep-pdgref[test]",
]
test = [
"pyquery", # for checking HTML output
"pytest",
"pytest-cov",
"pytest-xdist",
'importlib-metadata; python_version <"3.8.0"',
]

[project.readme]
content-type = "text/markdown"
file = "README.md"
Expand All @@ -80,6 +50,28 @@ Documentation = "https://github.com/ComPWA/sphinx-hep-pdgref/blob/main/README.md
Source = "https://github.com/ComPWA/sphinx-hep-pdgref"
Tracker = "https://github.com/ComPWA/sphinx-hep-pdgref/issues"

[dependency-groups]
dev = [
"ruff",
{include-group = "style"},
{include-group = "test"},
]
style = [
"mypy",
{include-group = "types"},
]
test = [
"pyquery",
"pytest",
"pytest-cov",
"pytest-xdist",
]
types = [
"pytest",
"types-docutils",
"types-setuptools",
]

[tool.setuptools]
include-package-data = true
license-files = ["LICENSE"]
Expand Down Expand Up @@ -151,6 +143,8 @@ reportUnusedFunction = true
reportUnusedImport = true
reportUnusedVariable = true
typeCheckingMode = "strict"
venv = ".venv"
venvPath = "."

[tool.pytest.ini_options]
addopts = [
Expand Down Expand Up @@ -277,6 +271,4 @@ allowlist_externals =
commands =
pre-commit run --all-files {posargs}
description = Perform all linting, formatting, and spelling checks
setenv =
SKIP = pyright
"""
Loading