Skip to content

Commit 76a8e8c

Browse files
authored
Merge branch 'main' into evolve-inherited-fields
2 parents 80f0177 + a6ae894 commit 76a8e8c

File tree

16 files changed

+1935
-117
lines changed

16 files changed

+1935
-117
lines changed

.github/CONTRIBUTING.md

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,42 +52,36 @@ First, **fork** the repository on GitHub and **clone** it using one of the alter
5252
You can (and should) run our test suite using [*tox*](https://tox.wiki/).
5353
However, you'll probably want a more traditional environment as well.
5454

55-
We recommend using the Python version from the `.python-version-default` file in the project's root directory, because that's the one that is used in the CI by default, too.
55+
We recommend using the Python version from the `.python-version-default` file in the project's root directory.
5656

57-
If you're using [*direnv*](https://direnv.net), you can automate the creation of the project virtual environment with the correct Python version by adding the following `.envrc` to the project root:
57+
We use a fully-locked development environment using [*uv*](https://docs.astral.sh/uv/) so the easiest way to get started is to [install *uv*](https://docs.astral.sh/uv/getting-started/installation/) and you can run `uv run pytest` to run the tests immediately.
58+
59+
I you'd like a traditional virtual environment, you can run `uv sync` and it will create a virtual environment named `.venv` with the correct Python version and install all the dependencies in the root directory.
60+
61+
If you're using [*direnv*](https://direnv.net), you can automate the creation and activation of the project's virtual environment with the correct Python version by adding the following `.envrc` to the project root:
5862

5963
```bash
60-
layout python python$(cat .python-version-default)
64+
uv sync
65+
. .venv/bin/activate
6166
```
6267

63-
or, if you like [*uv*](https://github.com/astral-sh/uv):
68+
---
69+
70+
If you don't want to use *uv*, you can use Pip 25.1 (that added support for dependency groups) or newer and install the dependencies manually:
6471

6572
```bash
66-
test -d .venv || uv venv --python python$(cat .python-version-default)
67-
. .venv/bin/activate
73+
pip install -e . --group dev
6874
```
6975

76+
---
77+
7078
> [!WARNING]
7179
> - **Before** you start working on a new pull request, use the "*Sync fork*" button in GitHub's web UI to ensure your fork is up to date.
7280
>
7381
> - **Always create a new branch off `main` for each new pull request.**
7482
> Yes, you can work on `main` in your fork and submit pull requests.
7583
> But this will *inevitably* lead to you not being able to synchronize your fork with upstream and having to start over.
7684
77-
Change into the newly created directory and after activating a virtual environment, install an editable version of this project along with its tests requirements:
78-
79-
```console
80-
$ pip install -e .[dev] # or `uv pip install -e .[dev]`
81-
```
82-
83-
Now you can run the test suite:
84-
85-
```console
86-
$ python -Im pytest
87-
```
88-
89-
You can *significantly* speed up the test suite by passing `-n auto` to *pytest* which activates [*pytest-xdist*](https://github.com/pytest-dev/pytest-xdist) and takes advantage of all your CPU cores.
90-
9185
---
9286

9387
When working on the documentation, use:
@@ -123,7 +117,6 @@ $ tox run -e docs-doctests
123117
- If you've changed or added public APIs, please update our type stubs (files ending in `.pyi`).
124118

125119

126-
127120
## Tests
128121

129122
- Write your asserts as `expected == actual` to line them up nicely, and leave an empty line before them:

.github/workflows/build-docset.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ jobs:
1717
docset:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2121
with:
2222
fetch-depth: 0
2323
persist-credentials: false
24-
- uses: actions/setup-python@v5
24+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2525
with:
2626
python-version: "3.x"
27-
- uses: hynek/setup-cached-uv@v2
27+
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
2828

2929
- run: uvx --with=tox-uv tox run -e docset
3030

31-
- uses: actions/upload-artifact@v4
31+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3232
with:
3333
name: docset
3434
path: attrs.tgz

.github/workflows/ci.yml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323
runs-on: ubuntu-latest
2424

2525
steps:
26-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727
with:
2828
fetch-depth: 0
2929
persist-credentials: false
3030

31-
- uses: hynek/build-and-inspect-python-package@v2
31+
- uses: hynek/build-and-inspect-python-package@b5076c307dc91924a82ad150cdd1533b444d3310 # v2.12.0
3232
id: baipp
3333

3434
outputs:
@@ -49,20 +49,24 @@ jobs:
4949

5050
steps:
5151
- name: Download pre-built packages
52-
uses: actions/download-artifact@v4
52+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
5353
with:
5454
name: Packages
5555
path: dist
5656
- run: tar xf dist/*.tar.gz --strip-components=1
57-
- uses: hynek/setup-cached-uv@v2
57+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
allow-prereleases: true
61+
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
5862

5963
- name: Prepare tox
6064
env:
6165
V: ${{ matrix.python-version }}
6266
run: |
6367
DO_MYPY=1
6468
65-
if [[ "$V" == "3.8" || "$V" == "3.9" ]]; then
69+
if [[ "$V" == "3.9" ]]; then
6670
DO_MYPY=0
6771
fi
6872
@@ -85,7 +89,7 @@ jobs:
8589
-e $TOX_PYTHON-tests
8690
8791
- name: Upload coverage data
88-
uses: actions/upload-artifact@v4
92+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
8993
with:
9094
name: coverage-data-${{ matrix.python-version }}
9195
path: .coverage.*
@@ -105,14 +109,14 @@ jobs:
105109

106110
steps:
107111
- name: Download pre-built packages
108-
uses: actions/download-artifact@v4
112+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
109113
with:
110114
name: Packages
111115
path: dist
112116
- run: |
113117
tar xf dist/*.tar.gz --strip-components=1
114118
rm -rf src # ensure tests run against wheel
115-
- uses: hynek/setup-cached-uv@v2
119+
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
116120

117121
- run: >
118122
uvx --with=tox-uv
@@ -127,15 +131,15 @@ jobs:
127131

128132
steps:
129133
- name: Download pre-built packages
130-
uses: actions/download-artifact@v4
134+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
131135
with:
132136
name: Packages
133137
path: dist
134138
- run: tar xf dist/*.tar.gz --strip-components=1
135-
- uses: hynek/setup-cached-uv@v2
139+
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
136140

137141
- name: Download coverage data
138-
uses: actions/download-artifact@v4
142+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
139143
with:
140144
pattern: coverage-data-*
141145
merge-multiple: true
@@ -154,7 +158,7 @@ jobs:
154158
coverage report --fail-under=100
155159
156160
- name: Upload HTML report if check failed.
157-
uses: actions/upload-artifact@v4
161+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
158162
with:
159163
name: html-report
160164
path: htmlcov
@@ -166,23 +170,23 @@ jobs:
166170
needs: build-package
167171
steps:
168172
- name: Download pre-built packages
169-
uses: actions/download-artifact@v4
173+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
170174
with:
171175
name: Packages
172176
path: dist
173177
- run: tar xf dist/*.tar.gz --strip-components=1
174-
- uses: hynek/setup-cached-uv@v2
178+
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
175179

176180
- run: uvx --with=tox-uv tox run -e docs-doctests,changelog
177181

178182
pyright:
179183
name: Check types using pyright
180184
runs-on: ubuntu-latest
181185
steps:
182-
- uses: actions/checkout@v4
186+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
183187
with:
184188
persist-credentials: false
185-
- uses: hynek/setup-cached-uv@v2
189+
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
186190

187191
- run: >
188192
uvx --with=tox-uv
@@ -194,10 +198,10 @@ jobs:
194198
runs-on: ubuntu-latest
195199

196200
steps:
197-
- uses: actions/checkout@v4
201+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
198202
with:
199203
persist-credentials: false
200-
- uses: hynek/setup-cached-uv@v2
204+
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
201205

202206
- run: uv venv --python $(cat .python-version-default)
203207
- run: uv pip install -e .[dev]
@@ -224,6 +228,6 @@ jobs:
224228

225229
steps:
226230
- name: Decide whether the needed jobs succeeded or failed
227-
uses: re-actors/alls-green@release/v1
231+
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
228232
with:
229233
jobs: ${{ toJSON(needs) }}

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ jobs:
2424

2525
steps:
2626
- name: Checkout repository
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2828
with:
2929
persist-credentials: false
3030

3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v3
32+
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
3333
with:
3434
languages: ${{ matrix.language }}
3535

3636
- name: Autobuild
37-
uses: github/codeql-action/autobuild@v3
37+
uses: github/codeql-action/autobuild@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
3838

3939
- name: Perform CodeQL Analysis
40-
uses: github/codeql-action/analyze@v3
40+
uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18

.github/workflows/codspeed.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ jobs:
3030
runs-on: ubuntu-latest
3131

3232
steps:
33-
- uses: actions/checkout@v4
33+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3434
with:
3535
persist-credentials: false
36-
- uses: actions/setup-python@v5
36+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
3737
with:
3838
python-version-file: .python-version-default
39-
- uses: hynek/setup-cached-uv@v2
39+
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
4040

4141
- name: Run CodSpeed benchmarks
42-
uses: CodSpeedHQ/action@v3
42+
uses: CodSpeedHQ/action@0010eb0ca6e89b80c88e8edaaa07cfe5f3e6664d # v3.5.0
4343
with:
4444
token: ${{ secrets.CODSPEED_TOKEN }}
4545
run: uvx --with tox-uv tox run -e codspeed

.github/workflows/pinact.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Pinact
3+
4+
on:
5+
schedule:
6+
- cron: "30 22 * * 4"
7+
workflow_dispatch:
8+
9+
permissions: {}
10+
11+
jobs:
12+
pinact:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
17+
steps:
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
with:
20+
persist-credentials: false
21+
22+
- name: Pin actions
23+
uses: suzuki-shunsuke/pinact-action@49cbd6acd0dbab6a6be2585d1dbdaa43b4410133 # v1.0.0

.github/workflows/pypi-package.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
id-token: write
2222

2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2525
with:
2626
fetch-depth: 0
2727
persist-credentials: false
2828

29-
- uses: hynek/build-and-inspect-python-package@v2
29+
- uses: hynek/build-and-inspect-python-package@b5076c307dc91924a82ad150cdd1533b444d3310 # v2.12.0
3030
with:
3131
attest-build-provenance-github: 'true'
3232

@@ -44,13 +44,13 @@ jobs:
4444

4545
steps:
4646
- name: Download packages built by build-and-inspect-python-package
47-
uses: actions/download-artifact@v4
47+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
4848
with:
4949
name: Packages
5050
path: dist
5151

5252
- name: Upload package to Test PyPI
53-
uses: pypa/gh-action-pypi-publish@release/v1
53+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
5454
with:
5555
attestations: true
5656
repository-url: https://test.pypi.org/legacy/
@@ -69,12 +69,12 @@ jobs:
6969

7070
steps:
7171
- name: Download packages built by build-and-inspect-python-package
72-
uses: actions/download-artifact@v4
72+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
7373
with:
7474
name: Packages
7575
path: dist
7676

7777
- name: Upload package to PyPI
78-
uses: pypa/gh-action-pypi-publish@release/v1
78+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
7979
with:
8080
attestations: true

.github/workflows/zizmor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ jobs:
1919
security-events: write
2020
steps:
2121
- name: Checkout repository
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2323
with:
2424
persist-credentials: false
25-
- uses: hynek/setup-cached-uv@v2
25+
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
2626

2727
- name: Run zizmor 🌈
2828
run: uvx zizmor --format sarif . > results.sarif
2929
env:
3030
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3131

3232
- name: Upload SARIF file
33-
uses: github/codeql-action/upload-sarif@v3
33+
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
3434
with:
3535
# Path to SARIF file relative to the root of the repository
3636
sarif_file: results.sarif

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ ci:
44

55
repos:
66
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: v0.11.4
7+
rev: v0.11.12
88
hooks:
9-
- id: ruff
9+
- id: ruff-check
1010
args: [--fix, --exit-non-zero-on-fix]
1111
- id: ruff-format
1212

0 commit comments

Comments
 (0)