Skip to content

Commit 9d83182

Browse files
Update infra (#182)
1 parent 71db7e0 commit 9d83182

File tree

8 files changed

+48
-69
lines changed

8 files changed

+48
-69
lines changed

.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 }}/tests ./tests
1818
cp ${{ github.workspace }}/pyproject.toml ./pyproject.toml
19-
python -m pip install -r ./tests/requirements.txt
20-
python -m tests
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: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
# Copyright 2023 Google LLC
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
151
name: Run tests
162

173
on:
@@ -21,7 +7,8 @@ jobs:
217
run-test:
228
strategy:
239
matrix:
24-
python-version: [ "3.10", "3.12" ]
10+
# must match the `language_version` in `.pre-commit-config.yaml`
11+
python-version: [ 3.11 ]
2512
os: [ ubuntu-latest ]
2613
fail-fast: false
2714
runs-on: ${{ matrix.os }}
@@ -37,12 +24,16 @@ jobs:
3724
- name: Install dependencies
3825
run: |
3926
python -m pip install --upgrade pip
40-
python -m pip install -r ./tests/requirements.txt
27+
python -m pip install '.[dev,docs,tests]'
4128
4229
- name: Checks with pre-commit
43-
uses: pre-commit/action@v3.0.1
30+
run: |
31+
pre-commit run --all-files
4432
4533
- name: Test with pytest
4634
run: |
47-
python -m pip install .
48-
python -m tests
35+
pytest
36+
37+
- name: Check that documentation can be built.
38+
run: |
39+
mkdocs build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ examples/data
99
.pymon
1010
.idea
1111
.venv
12+
uv.lock

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ repos:
2222
files: ^pyproject\.toml$
2323
additional_dependencies: ["toml-sort==0.23.1"]
2424
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: v0.1.7
25+
rev: v0.13.0
2626
hooks:
2727
- id: ruff-format
2828
types_or: [ python, pyi, jupyter ]
2929
- id: ruff
3030
types_or: [ python, pyi, jupyter ]
3131
args: [ --fix ]
3232
- repo: https://github.com/RobertCraigie/pyright-python
33-
rev: v1.1.330
33+
rev: v1.1.406
3434
hooks:
3535
- id: pyright
3636
additional_dependencies: ["jax", "equinox", "pytest"]

CONTRIBUTING.md

Lines changed: 6 additions & 32 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/lineax.git
1515
cd lineax
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 Black to format the code, and ruff to lint 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 tests/requirements.txt
38-
python -m tests
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:
@@ -53,26 +45,8 @@ Finally, open a pull request on GitHub!
5345
Make your changes. You can then build the documentation by doing
5446

5547
```bash
56-
pip install -r docs/requirements.txt
48+
pip install -e '.[docs]'
5749
mkdocs serve
5850
```
59-
Then doing `Control-C`, and running:
60-
```
61-
mkdocs serve
62-
```
63-
(So you run `mkdocs serve` twice.)
6451

6552
You can then see your local copy of the documentation by navigating to `localhost:8000` in a web browser.
66-
67-
## Contributor License Agreement
68-
69-
Contributions to this project must be accompanied by a Contributor License
70-
Agreement (CLA). You (or your employer) retain the copyright to your
71-
contribution; this simply gives us permission to use and redistribute your
72-
contributions as part of the project. Head over to
73-
<https://cla.developers.google.com/> to see your current agreements on file or
74-
to sign a new one.
75-
76-
You generally only need to submit a CLA once, so if you've already submitted one
77-
(even if it was for a different project), you probably don't need to do it
78-
again.

lineax/_solver/gmres.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def _normalise(
410410
eps = jnp.finfo(norm.dtype).eps
411411
else:
412412
eps = jnp.astype(eps, norm.dtype)
413-
breakdown = norm < eps
413+
breakdown = norm < eps # pyright: ignore
414414
safe_norm = jnp.where(breakdown, jnp.inf, norm)
415415
with jax.numpy_dtype_promotion("standard"):
416416
x_normalised = (x**ω / safe_norm).ω

pyproject.toml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,27 @@ urls = {repository = "https://github.com/google/lineax"}
3131
version = "0.0.8"
3232

3333
[project.optional-dependencies]
34+
dev = [
35+
"pre-commit"
36+
]
3437
docs = [
35-
"hippogriffe==0.2.0",
38+
"hippogriffe==0.2.2",
39+
"griffe==1.7.3",
3640
"mkdocs==1.6.1",
3741
"mkdocs-include-exclude-files==0.1.0",
38-
"mkdocs-ipynb==0.1.0",
42+
"mkdocs-ipynb==0.1.1",
3943
"mkdocs-material==9.6.7",
40-
"mkdocstrings[python]==0.28.3",
44+
"mkdocstrings==0.28.3",
45+
"mkdocstrings-python==1.16.8",
4146
"pymdown-extensions==10.14.3"
4247
]
48+
tests = [
49+
"beartype",
50+
"equinox",
51+
"pytest",
52+
"pytest-xdist",
53+
"jaxlib"
54+
]
4355

4456
[tool.hatch.build]
4557
include = ["lineax/*"]
@@ -53,14 +65,20 @@ addopts = "--jaxtyping-packages=lineax,beartype.beartype(conf=beartype.BeartypeC
5365

5466
[tool.ruff]
5567
extend-include = ["*.ipynb"]
56-
fixable = ["I001", "F401", "UP"]
57-
ignore = ["E402", "E721", "E731", "E741", "F722", "UP038"]
58-
ignore-init-module-imports = true
59-
select = ["E", "F", "I001", "UP"]
6068
src = []
6169

6270
[tool.ruff.isort]
6371
combine-as-imports = true
6472
extra-standard-library = ["typing_extensions"]
6573
lines-after-imports = 2
6674
order-by-type = false
75+
76+
[tool.ruff.lint]
77+
fixable = ["I001", "F401", "UP"]
78+
ignore = ["E402", "E721", "E731", "E741", "F722", "UP038"]
79+
select = ["E", "F", "I001", "UP"]
80+
81+
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
82+
"collections" = "co"
83+
"functools" = "ft"
84+
"itertools" = "it"

tests/requirements.txt

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

0 commit comments

Comments
 (0)