Skip to content

Commit 6be5df2

Browse files
committed
chore: cleanup
1 parent b70bec3 commit 6be5df2

8 files changed

Lines changed: 18 additions & 137 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,8 @@ jobs:
1818
uses: astral-sh/setup-uv@v8.1.0
1919
- name: Sync environment
2020
run: uv sync --extra dev
21-
- name: Ruff check (package + scripts)
22-
run: uv run ruff check src tests
23-
- name: Ruff check (notebooks)
24-
run: uv run nbqa ruff notebooks
25-
- name: Check Binder requirements are in sync
26-
run: |
27-
cp .binder/requirements.txt /tmp/requirements.committed.txt
28-
bash scripts/export_requirements.sh
29-
diff /tmp/requirements.committed.txt .binder/requirements.txt \
30-
|| (echo "::error::.binder/requirements.txt is stale; run scripts/export_requirements.sh" && exit 1)
21+
- name: Run pre-commit hooks
22+
run: uv run pre-commit run --all-files
3123

3224
notebooks:
3325
runs-on: ubuntu-latest

CONTRIBUTING.md

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,28 @@ The notebook set is designed to grow. To add one:
88

99
1. **Pick the next number.** Notebooks use a two-digit prefix
1010
(`05-your-topic.ipynb`) in `notebooks/`. The number defines reading order.
11-
2. **Write the notebook.** Keep it focused on a single learning goal. State
12-
prerequisites in the first markdown cell. Reuse the `ref_tutorials` helper
13-
package rather than repeating client/plotting boilerplate — if you find
14-
yourself copying code between notebooks, add a helper instead.
11+
2. **Write the notebook.** Keep it focused on a single learning goal.
12+
State prerequisites in the first markdown cell.
13+
Reuse the `ref_tutorials` helper package rather than repeating client/plotting boilerplate.
1514
3. **Add an index row.** Add the notebook to the table in `README.md`.
16-
4. **Leave outputs in.** Notebook outputs are intentionally committed so the
17-
notebooks render on GitHub. Run the notebook top-to-bottom before
18-
committing so the saved outputs are current.
15+
4. **Leave outputs in.** Notebook outputs are intentionally committed so the notebooks render on GitHub.
16+
Run the notebook top-to-bottom before committing so the saved outputs are current.
1917
5. **Check it passes CI** (below).
2018

2119
## The `ref_tutorials` helper package
2220

23-
Shared logic lives in `src/ref_tutorials`. It has a deliberately small, stable
24-
interface. New helpers should be pure and testable where possible — add a unit
25-
test in `tests/` for any non-trivial logic.
21+
Shared logic lives in `src/ref_tutorials`.
22+
It has a deliberately small, stable interface.
23+
New helpers should be pure and testable where possible.
24+
Add a unit test in `tests/` for any non-trivial logic.
2625

2726
## Running checks locally
2827

2928
```bash
3029
uv sync --extra dev
3130

3231
# Lint
33-
uv run ruff check src tests
34-
uv run nbqa ruff notebooks
32+
uv run ruff check .
3533

3634
# Unit tests for the helper package
3735
uv run pytest tests
@@ -43,17 +41,11 @@ uv run pytest --nbmake notebooks
4341

4442
## Dependencies
4543

46-
`pyproject.toml` is the source of truth, managed with `uv`. After changing
47-
dependencies, regenerate the Binder requirements file:
48-
49-
```bash
50-
bash scripts/export_requirements.sh
51-
```
52-
53-
CI fails if `.binder/requirements.txt` is out of sync.
44+
`pyproject.toml` is the source of truth, managed with `uv`.
45+
After changing dependencies,
46+
the pre-commit hook will update the `requirements.txt` file which is used by Binder.
5447

5548
## CI
5649

57-
Every pull request runs three jobs: lint, helper-package unit tests, and full
58-
notebook execution. A weekly scheduled run catches drift against the live REF
59-
API even when the repo is idle.
50+
Every pull request runs three jobs: lint, helper-package unit tests, and full notebook execution.
51+
A weekly scheduled run catches drift against the live REF API even when the repo is idle.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ dependencies = [
3535
dev = [
3636
"pytest>=8.0",
3737
"nbmake>=1.5",
38-
"nbqa>=1.8",
3938
"ruff>=0.6",
4039
"pre-commit>=4.6",
4140
]

src/ref_tutorials/plotting.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
readers a recipe they can copy into their own work.
55
"""
66

7-
from __future__ import annotations
8-
97
from pathlib import Path
108

119
import matplotlib.pyplot as plt

src/ref_tutorials/provider.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
- **figures** (a timeseries plot and an anomaly plot).
1515
"""
1616

17-
from __future__ import annotations
18-
1917
import importlib.metadata
2018
from pathlib import Path
2119

tests/test_provider.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
notebook 04 in CI; here we only check the provider is wired up correctly.
99
"""
1010

11-
from __future__ import annotations
12-
1311
import pytest
1412

1513
pytest.importorskip("climate_ref_core")

tests/test_ref_tutorials.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Unit tests for the ``ref_tutorials`` helper package."""
22

3-
from __future__ import annotations
4-
53
from dataclasses import dataclass, field
64

75
import matplotlib
@@ -16,8 +14,6 @@
1614
)
1715
from ref_tutorials.plotting import PUBLICATION_RCPARAMS
1816

19-
# The Agg backend is selected in conftest.py before this module is imported.
20-
2117

2218
@dataclass
2319
class _Dimensions:
@@ -30,7 +26,7 @@ class _MetricValue:
3026
dimensions: _Dimensions
3127

3228
@classmethod
33-
def make(cls, value: float, **dims: object) -> _MetricValue:
29+
def make(cls, value: float, **dims: object) -> "_MetricValue":
3430
return cls(value=value, dimensions=_Dimensions(additional_properties=dict(dims)))
3531

3632

0 commit comments

Comments
 (0)