Skip to content

Commit fa068de

Browse files
authored
chore: Add release skills (#751)
* Add prepare-release skill * Add check-release skill * Remove section about releasing from CONTRIBUTING.md * Add section about working with agents in CONTRIBUTING.md
1 parent 1aed3c3 commit fa068de

3 files changed

Lines changed: 207 additions & 23 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ CC=gcc uv pip install --python-version=3.14 -e '.[full]' --group check --group d
9595
uv run pre-commit install
9696
```
9797

98+
## Working with agents
99+
100+
We encourage contributors to use AI agents when contributing to TorchJD, but there are a few rules:
101+
- The initiative should come from a human. We do not want PRs from fully automated bots.
102+
- The changes should be reviewed by a human before a non-draft PR is open.
103+
- To avoid vendor lock-in, we do not provide any file that is specific to an agent vendor. To use a specific agent that does not follow open file naming conventions, you have to adapt a few things yourself (e.g. symlink files). For example, to work with claude, you have to symlink `CLAUDE.md` to `AGENTS.md`, and `.claude/skill/` to `skills/`.
104+
98105
## Checks
99106

100107
### Running tests
@@ -275,26 +282,3 @@ The three plot scripts produce PDFs saved to `tests/trajectories/results/<object
275282
> [!NOTE]
276283
> The plot scripts require a LaTeX installation for rendering:
277284
> `sudo apt-get install texlive-latex-extra texlive-fonts-recommended dvipng cm-super`
278-
279-
280-
## Release
281-
282-
*This section is addressed to maintainers.*
283-
284-
To release a new `torchjd` version, you have to:
285-
- If the release introduces changes to the interface, make sure that `README.md` reflects those
286-
changes.
287-
- Make sure that all tests, including those on cuda, pass (for this, you need access to a machine
288-
that has a cuda-enabled GPU).
289-
- Make sure that all important changes since the last release have been reported in the
290-
`[Unreleased]` section at the top of the changelog.
291-
- Add a `[X.Y.Z] - yyyy-mm-dd` header in the changelog just below the `[Unreleased]` header.
292-
- Change the version in `pyproject.toml`.
293-
- Make a pull request with those changes and merge it.
294-
- Make a draft of the release on GitHub (click on `Releases`, then `Draft a new release`, then fill
295-
the details).
296-
- Publish the release (click on `Publish release`). This should trigger the deployment of the new
297-
version on PyPI and the building and deployment of the documentation on github-pages.
298-
- Check that the new version is correctly deployed to PyPI, that it is installable and that it
299-
works.
300-
- Check that the documentation has been correctly deployed.

‎skills/check-release/SKILL.md‎

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
name: check-release
3+
description: Verifies that a TorchJD release was published correctly by checking the docs site, installing from PyPI, and smoke-testing newly added classes. Use after a release has been merged and published.
4+
---
5+
6+
# Check TorchJD Release
7+
8+
This skill verifies that a release is live and correct after it has been published.
9+
10+
**For agents:** invoke as `/check-release X.Y.Z` (e.g. `/check-release 0.16.0`).
11+
If no version is provided, read the current version from `pyproject.toml`.
12+
13+
---
14+
15+
## Instructions
16+
17+
### Step 1: Determine the version
18+
19+
Read `pyproject.toml` to find the `version` field under `[project]`. Use the version provided as
20+
an argument, or the one from `pyproject.toml` if none is given.
21+
22+
### Step 2: Identify newly added classes
23+
24+
Read `CHANGELOG.md` and find the `## [X.Y.Z]` section. Extract the names of any newly added
25+
public classes, functions, or methods listed under `### Added`. You will use these in later steps.
26+
27+
### Step 3: Check the docs site
28+
29+
Fetch `https://torchjd.org`.
30+
31+
- Verify that the versions dropdown (or switcher) includes `vX.Y.Z` as an entry.
32+
- Verify that the `stable` entry is present.
33+
34+
If the version entry is missing, report it and stop — the rest of the checks depend on the docs
35+
being live.
36+
37+
### Step 4: Verify the new-version docs contain the newly added classes
38+
39+
For each newly added class or function identified in Step 2, fetch its expected docs page under
40+
`https://torchjd.org/vX.Y.Z/`. Use the URL patterns from similar existing classes found in
41+
`README.md` or by browsing the stable docs (`https://torchjd.org/stable/`) to infer the correct
42+
path (e.g. `https://torchjd.org/vX.Y.Z/docs/aggregation`,
43+
`https://torchjd.org/vX.Y.Z/docs/scalarization`, etc.).
44+
45+
Confirm that each new class/function name appears on the fetched page.
46+
47+
### Step 5: Verify the stable docs also reflect the new version
48+
49+
Fetch the same doc pages under `https://torchjd.org/stable/` and confirm the newly added
50+
classes/functions appear there too (i.e. `stable` points to the new release).
51+
52+
### Step 6: Install torchjd from PyPI in a temp environment
53+
54+
Run the following commands to create an isolated install:
55+
56+
```bash
57+
cd /tmp && mkdir -p test_torchjd_install && cd test_torchjd_install
58+
uv venv && uv pip install torchjd
59+
```
60+
61+
Verify the installed version matches X.Y.Z:
62+
63+
```bash
64+
cd /tmp/test_torchjd_install && uv pip show torchjd
65+
```
66+
67+
If the version is wrong, report it and stop.
68+
69+
### Step 7: Smoke-test the newly added classes
70+
71+
Write a minimal Python script `/tmp/test_torchjd_install/smoke_test.py` that:
72+
73+
- Imports each newly added class or function by its fully-qualified name from `torchjd`.
74+
- Instantiates or calls each one with a minimal valid input (e.g. a small `torch.Tensor`, a dummy
75+
preference vector, or no arguments if the class takes none).
76+
- Does NOT assert correctness of values — only that the code runs without raising an exception.
77+
78+
Use the existing test suite under `tests/` or the docs pages fetched in Step 4 as a reference for
79+
correct import paths and minimal usage patterns.
80+
81+
Run the script:
82+
83+
```bash
84+
cd /tmp/test_torchjd_install && uv run python smoke_test.py
85+
```
86+
87+
Report the result. If it crashes, show the traceback.
88+
89+
### Step 8: Clean up
90+
91+
```bash
92+
rm -rf /tmp/test_torchjd_install
93+
```
94+
95+
### Step 9: Report
96+
97+
Summarize what was verified:
98+
- Docs site: version dropdown ✓/✗, new-version page ✓/✗, stable page ✓/✗
99+
- PyPI install: version matches ✓/✗
100+
- Smoke test: each newly added class ✓/✗ (list them)
101+
102+
If everything passes, the release is confirmed good. If anything failed, describe what needs
103+
attention.

‎skills/prepare-release/SKILL.md‎

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
name: prepare-release
3+
description: Prepares a torchjd package release by verifying the changelog, README, bumping the version in pyproject.toml, and opening a release PR. Use when a maintainer asks to prepare a release or to release.
4+
---
5+
6+
# Prepare TorchJD Release
7+
8+
This skill covers the pre-merge steps of the release process.
9+
10+
**For agents:** invoke as `/prepare-release X.Y.Z` (e.g. `/prepare-release 0.16.0`).
11+
If no version is provided, read the current version from `pyproject.toml` and ask the user
12+
what the new version should be before proceeding.
13+
14+
**For humans:** follow the numbered steps below in your terminal.
15+
Replace `X.Y.Z` with the version you are releasing and `yyyy-mm-dd` with today's date.
16+
17+
---
18+
19+
## Instructions
20+
21+
### Step 1: Determine the version
22+
23+
Read `pyproject.toml` to find the current `version` field under `[project]`. The new release
24+
version is either provided as an argument or must be confirmed with the user before continuing.
25+
26+
Verify it follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
27+
28+
### Step 2: Verify CHANGELOG
29+
30+
Read `CHANGELOG.md` and compare it against the commits done since the last version release. Verify that no user-facing change was forgotten, and that all were correctly added under the [Unreleased] section.
31+
32+
### Step 3: Check README for interface changes
33+
34+
Read `CHANGELOG.md` and identify any entries in the `[Unreleased]` section that affect the public
35+
interface (new or removed classes, functions, or arguments; changed signatures or behavior).
36+
37+
If such entries exist, read `README.md` and verify it accurately describes the current interface.
38+
39+
If a table listing methods exists in `README.md`, add to it any newly added method of the corresponding type.
40+
41+
If anything else seems missing, report that to the user.
42+
43+
### Step 4: Run the unit tests
44+
45+
CRITICAL: Do not skip this step, even partially.
46+
47+
Run the unit tests and confirm they all pass both on CPU and GPU (you need a CUDA-enabled GPU for this):
48+
49+
```bash
50+
uv run pytest tests/unit
51+
PYTEST_TORCH_DEVICE=cuda:0 uv run pytest tests/unit
52+
```
53+
54+
If any tests fail, stop and report the failures. Do not proceed to the next steps.
55+
56+
### Step 5: Add the version header to the changelog
57+
58+
In `CHANGELOG.md`, insert a new `## [X.Y.Z] - yyyy-mm-dd` heading immediately after the blank
59+
line that follows `## [Unreleased]`, before the existing subsections:
60+
61+
```diff
62+
## [Unreleased]
63+
64+
+## [X.Y.Z] - yyyy-mm-dd
65+
+
66+
### Added
67+
```
68+
69+
The `[Unreleased]` section stays in place and will accumulate entries for the next release.
70+
The newly-inserted heading claims the existing content as its own.
71+
72+
### Step 6: Bump the version in `pyproject.toml`
73+
74+
In `pyproject.toml`, update the `version` field under `[project]`:
75+
76+
```diff
77+
-version = "A.B.C"
78+
+version = "X.Y.Z"
79+
```
80+
81+
### Step 7: Open the release PR
82+
83+
Stage changes, then open a pull request targeting `main`.
84+
Return the PR URL when done.
85+
86+
### Step 8: Create a draft release on GitHub
87+
88+
CRITICAL: The release you'll create should ALWAYS be a draft. Never even suggest to make the real release. A maintainer will manually release the draft if it seems ready.
89+
90+
The command should be:
91+
```
92+
gh release create vX.Y.Z --draft --title vX.Y.Z --notes "<insert notes here>"
93+
```
94+
95+
To write the actual release notes, look at what is done in recent releases and suggest the new notes. Make it short. Also, prompt the user for a good-looking emoji (propose a list) to use in the main section of the release notes.
96+
97+
---

0 commit comments

Comments
 (0)