Skip to content

Commit 46bc116

Browse files
Modernise CI + CONTRIBUTING + docstack
1 parent 98f07d0 commit 46bc116

File tree

4 files changed

+42
-23
lines changed

4 files changed

+42
-23
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@ jobs:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Release
32-
uses: patrick-kidger/action_update_python_project@v6
32+
uses: patrick-kidger/action_update_python_project@v8
3333
with:
3434
python-version: "3.11"
3535
test-script: |
36-
python -m pip install .[tests]
37-
python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
3836
cp -r ${{ github.workspace }}/test ./test
39-
pytest
37+
cp ${{ github.workspace }}/pyproject.toml ./pyproject.toml
38+
uv sync --extra tests --no-install-project --inexact
39+
uv pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
40+
uv run --no-sync pytest
4041
pypi-token: ${{ secrets.pypi_token }}
4142
github-user: patrick-kidger
4243
github-token: ${{ github.token }}

.github/workflows/run_tests.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@ jobs:
4242
- name: Install dependencies
4343
run: |
4444
python -m pip install --upgrade pip
45-
python -m pip install .[tests]
45+
python -m pip install '.[dev,docs,tests]'
4646
python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
4747
4848
- name: Checks with pre-commit
49-
uses: pre-commit/action@v3.0.1
49+
run: |
50+
pre-commit run --all-files
5051
5152
- name: Test with pytest
5253
run: |
53-
python -m pip install .
54-
python -m pytest --durations=0
54+
pytest
55+
56+
- name: Check that documentation can be built.
57+
run: |
58+
mkdocs build

CONTRIBUTING.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,32 @@ Contributions (pull requests) are very welcome! Here's how to get started.
44

55
---
66

7+
**Getting started**
8+
79
First fork the library on GitHub.
810

9-
Then clone and install the library in development mode:
11+
Then clone and install the library:
1012

1113
```bash
1214
git clone https://github.com/your-username-here/jaxtyping.git
1315
cd jaxtyping
14-
pip install -e .
16+
pip install -e '.[dev]'
17+
pre-commit install # `pre-commit` is installed by `pip` on the previous line
1518
```
1619

17-
Then install the pre-commit hook:
18-
19-
```bash
20-
pip install pre-commit
21-
pre-commit install
22-
```
20+
---
2321

24-
These hooks use ruff to lint and format the code.
22+
**If you're making changes to the code:**
2523

2624
Now make your changes. Make sure to include additional tests if necessary.
2725

2826
Next verify the tests all pass:
2927

3028
```bash
31-
pip install -e .[tests]
29+
pip install -e '.[tests]'
30+
# The torch line might need adjusting depending on your operating system, see https://pytorch.org
3231
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
33-
pytest
32+
pytest # `pytest` is installed by `pip` on the previous line.
3433
```
3534

3635
Then push your changes back to your fork of the repository:
@@ -40,3 +39,16 @@ git push
4039
```
4140

4241
Finally, open a pull request on GitHub!
42+
43+
---
44+
45+
**If you're making changes to the documentation:**
46+
47+
Make your changes. You can then build the documentation by doing
48+
49+
```bash
50+
pip install -e '.[docs]'
51+
mkdocs serve
52+
```
53+
54+
You can then see your local copy of the documentation by navigating to `localhost:8000` in a web browser.

pyproject.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ dev = [
3131
"pre-commit>=4.3.0",
3232
]
3333
docs = [
34-
"hippogriffe==0.2.0",
34+
"hippogriffe==0.2.1",
35+
"griffe==1.7.3",
3536
"mkdocs==1.6.1",
3637
"mkdocs-include-exclude-files==0.1.0",
37-
"mkdocs-ipynb==0.1.0",
38+
"mkdocs-ipynb==0.1.1",
3839
"mkdocs-material==9.6.7",
39-
"mkdocstrings[python]==0.28.3",
40+
"mkdocstrings==0.28.3",
41+
"mkdocstrings-python==1.16.8",
4042
"pymdown-extensions==10.14.3",
4143
]
4244
tests = [
@@ -50,7 +52,7 @@ tests = [
5052
"pytest>=8.4.2",
5153
"pytest-asyncio>=1.2.0",
5254
"tensorflow>=2.18.1",
53-
"typeguard<3",
55+
"typeguard==2.13.3",
5456
]
5557

5658

0 commit comments

Comments
 (0)