Skip to content

Commit 663f311

Browse files
Standardised infra
1 parent 2fd3ef3 commit 663f311

7 files changed

Lines changed: 37 additions & 32 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Release
13-
uses: patrick-kidger/action_update_python_project@v6
13+
uses: patrick-kidger/action_update_python_project@v8
1414
with:
1515
python-version: "3.11"
1616
test-script: |
1717
cp -r ${{ github.workspace }}/test ./test
1818
cp ${{ github.workspace }}/pyproject.toml ./pyproject.toml
19-
python -m pip install -r ./test/requirements.txt
20-
python -m test
19+
uv sync --extra tests --no-install-project --inexact
20+
uv run --no-sync pytest
2121
pypi-token: ${{ secrets.pypi_token }}
2222
github-user: patrick-kidger
2323
github-token: ${{ github.token }}

.github/workflows/run_tests.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ jobs:
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip
26-
python -m pip install -r ./test/requirements.txt
27-
26+
python -m pip install '.[dev,docs,tests]'
2827
2928
- name: Checks with pre-commit
30-
uses: pre-commit/action@v3.0.1
29+
run: |
30+
pre-commit run --all-files
3131
3232
- name: Test with pytest
3333
run: |
34-
python -m pip install .
35-
python -m test
34+
pytest
35+
36+
- name: Check that documentation can be built.
37+
run: |
38+
mkdocs build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ site/
88
.pymon
99
.idea/
1010
.venv/
11+
uv.lock

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ repos:
88
files: ^pyproject\.toml$
99
additional_dependencies: ["toml-sort==0.23.1"]
1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.2.2
11+
rev: v0.13.0
1212
hooks:
1313
- id: ruff-format # formatter
14-
types_or: [ python, pyi, jupyter ]
14+
types_or: [ python, pyi, jupyter, toml ]
1515
- id: ruff # linter
16-
types_or: [ python, pyi, jupyter ]
16+
types_or: [ python, pyi, jupyter, toml ]
1717
args: [ --fix ]
1818
- repo: https://github.com/RobertCraigie/pyright-python
19-
rev: v1.1.350
19+
rev: v1.1.405
2020
hooks:
2121
- id: pyright
2222
additional_dependencies: [equinox, jax, jaxtyping, optax, optimistix, lineax, pytest, typeguard==2.13.3, typing_extensions, wadler_lindig]

CONTRIBUTING.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,15 @@ Contributions (pull requests) are very welcome! Here's how to get started.
88

99
First fork the library on GitHub.
1010

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

1313
```bash
1414
git clone https://github.com/your-username-here/diffrax.git
1515
cd diffrax
16-
pip install -e .
16+
pip install -e '.[dev]'
17+
pre-commit install # `pre-commit` is installed by `pip` on the previous line
1718
```
1819

19-
Then install the pre-commit hook:
20-
21-
```bash
22-
pip install pre-commit
23-
pre-commit install
24-
```
25-
26-
These hooks use ruff to lint and format the code, and pyright to type-check it.
27-
2820
---
2921

3022
**If you're making changes to the code:**
@@ -34,8 +26,8 @@ Now make your changes. Make sure to include additional tests if necessary.
3426
Next verify the tests all pass:
3527

3628
```bash
37-
pip install -r test/requirements.txt
38-
pytest
29+
pip install -e '.[tests]'
30+
pytest # `pytest` is installed by `pip` on the previous line.
3931
```
4032

4133
Then push your changes back to your fork of the repository:

pyproject.toml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ keywords = ["jax", "dynamical-systems", "differential-equations", "deep-learning
2525
license = {file = "LICENSE"}
2626
name = "diffrax"
2727
readme = "README.md"
28-
requires-python = ">=3.10,<4.0"
28+
requires-python = ">=3.10"
2929
urls = {repository = "https://github.com/patrick-kidger/diffrax"}
3030
version = "0.7.0"
3131

3232
[project.optional-dependencies]
33+
dev = ["pre-commit"]
3334
docs = [
3435
"hippogriffe==0.2.2",
36+
"griffe==1.7.3",
3537
"mkdocs==1.6.1",
3638
"mkdocs-include-exclude-files==0.1.0",
3739
"mkdocs-ipynb==0.1.1",
@@ -40,6 +42,14 @@ docs = [
4042
"mkdocstrings-python==1.16.8",
4143
"pymdown-extensions==10.14.3"
4244
]
45+
tests = [
46+
"beartype",
47+
"jaxlib",
48+
"optax",
49+
"pytest",
50+
"scipy",
51+
"tqdm",
52+
]
4353

4454
[tool.hatch.build]
4555
include = ["diffrax/*"]
@@ -64,6 +74,11 @@ ignore = ["E402", "E721", "E731", "E741", "F722", "UP038"]
6474
ignore-init-module-imports = true
6575
select = ["E", "F", "I001", "UP"]
6676

77+
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
78+
"collections" = "co"
79+
"functools" = "ft"
80+
"itertools" = "it"
81+
6782
[tool.ruff.lint.isort]
6883
combine-as-imports = true
6984
extra-standard-library = ["typing_extensions"]

test/requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)