Skip to content

Commit 6467422

Browse files
authored
Merge branch 'main' into doc/pre-commit
2 parents d4f3cfc + adf3271 commit 6467422

File tree

44 files changed

+1223
-1207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1223
-1207
lines changed

.github/workflows/shared.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Shared Checks
33
on:
44
workflow_call:
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
pre-commit:
811
runs-on: ubuntu-latest
@@ -46,3 +49,19 @@ jobs:
4649
- name: Run pytest
4750
run: uv run --frozen --no-sync pytest
4851
continue-on-error: true
52+
53+
readme-snippets:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- uses: astral-sh/setup-uv@v5
59+
with:
60+
enable-cache: true
61+
version: 0.7.2
62+
63+
- name: Install dependencies
64+
run: uv sync --frozen --all-extras --python 3.10
65+
66+
- name: Check README snippets are up to date
67+
run: uv run --frozen scripts/update_readme_snippets.py --check

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ repos:
2323
types: [python]
2424
language: system
2525
pass_filenames: false
26+
exclude: ^README\.md$
2627
- id: pyright
2728
name: pyright
2829
entry: uv run pyright
@@ -36,3 +37,9 @@ repos:
3637
language: system
3738
files: ^(pyproject\.toml|uv\.lock)$
3839
pass_filenames: false
40+
- id: readme-snippets
41+
name: Check README snippets are up to date
42+
entry: uv run scripts/update_readme_snippets.py --check
43+
language: system
44+
files: ^(README\.md|examples/.*\.py|scripts/update_readme_snippets\.py)$
45+
pass_filenames: false

CONTRIBUTING.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,18 @@ uv run ruff check .
4545
uv run ruff format .
4646
```
4747

48-
7. (Optional) Run pre-commit hooks on all files:
48+
7. Update README snippets if you modified example code:
49+
```bash
50+
uv run scripts/update_readme_snippets.py
51+
```
52+
53+
8. (Optional) Run pre-commit hooks on all files:
4954

5055
```bash
5156
pre-commit run --all-files
5257
```
5358

54-
8. Submit a pull request to the same branch you branched from
59+
9. Submit a pull request to the same branch you branched from
5560

5661
## Code Style
5762

0 commit comments

Comments
 (0)