Skip to content

Commit bb5c52c

Browse files
authored
Merge branch 'main' into codecov-v4
2 parents f644e98 + 0090581 commit bb5c52c

File tree

126 files changed

+1489
-660
lines changed

Some content is hidden

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

126 files changed

+1489
-660
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# sorting all imports with isort
22
933f77b96f0092e1baab4474a9208fc2e379aa32
3+
# enabling ruff's flake8-commas rule
4+
b25c02a94e2defcb0fad32976b02218be1133bdf

.github/workflows/autodeps.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,35 @@ jobs:
1717
issues: write
1818
repository-projects: write
1919
contents: write
20+
2021
steps:
2122
- name: Checkout
2223
uses: actions/checkout@v4
2324
- name: Setup python
2425
uses: actions/setup-python@v5
2526
with:
2627
python-version: "3.8"
28+
2729
- name: Bump dependencies
2830
run: |
2931
python -m pip install -U pip pre-commit
3032
python -m pip install -r test-requirements.txt
31-
uv pip compile --no-strip-markers --python-version=3.8 --upgrade test-requirements.in -o test-requirements.txt
32-
uv pip compile --no-strip-markers --python-version=3.8 --upgrade docs-requirements.in -o docs-requirements.txt
33+
uv pip compile --universal --python-version=3.8 --upgrade test-requirements.in -o test-requirements.txt
34+
uv pip compile --universal --python-version=3.11 --upgrade docs-requirements.in -o docs-requirements.txt
3335
pre-commit autoupdate --jobs 0
36+
37+
- name: Install new requirements
38+
run: python -m pip install -r test-requirements.txt
39+
40+
# apply newer versions' formatting
3441
- name: Black
42+
run: black src/trio
43+
44+
- name: uv
3545
run: |
36-
# The new dependencies may contain a new black version.
37-
# Commit any changes immediately.
38-
python -m pip install -r test-requirements.txt
39-
black src/trio
46+
uv pip compile --universal --python-version=3.8 test-requirements.in -o test-requirements.txt
47+
uv pip compile --universal --python-version=3.11 docs-requirements.in -o docs-requirements.txt
48+
4049
- name: Commit changes and create automerge PR
4150
env:
4251
GH_TOKEN: ${{ github.token }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check newsfragment
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, synchronize]
6+
branches:
7+
- main
8+
9+
jobs:
10+
check-newsfragment:
11+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip newsfragment') }}
12+
runs-on: 'ubuntu-latest'
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Check newsfragments
20+
run: |
21+
if git diff --name-only origin/main | grep -v '/_tests/' | grep 'src/trio/'; then
22+
git diff --name-only origin/main | grep 'newsfragments/' || exit 1
23+
fi

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
21+
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12']
2222
arch: ['x86', 'x64']
2323
lsp: ['']
2424
lsp_extract_file: ['']
@@ -89,12 +89,12 @@ jobs:
8989
strategy:
9090
fail-fast: false
9191
matrix:
92-
python: ['pypy-3.9', 'pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
92+
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
9393
check_formatting: ['0']
9494
no_test_requirements: ['0']
9595
extra_name: ['']
9696
include:
97-
- python: '3.8'
97+
- python: '3.12'
9898
check_formatting: '1'
9999
extra_name: ', check formatting'
100100
# separate test run that doesn't install test-requirements.txt
@@ -147,7 +147,7 @@ jobs:
147147
strategy:
148148
fail-fast: false
149149
matrix:
150-
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
150+
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12']
151151
continue-on-error: >-
152152
${{
153153
(

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
on:
2+
push:
3+
tags:
4+
- v*
5+
6+
# a lot of code taken from https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.8"
16+
- run: python -m pip install build
17+
- run: python -m build
18+
19+
- uses: actions/upload-artifact@v4
20+
with:
21+
name: trio-dist
22+
path: |
23+
dist/*.tar.gz
24+
dist/*.whl
25+
26+
pypi-publish:
27+
needs: [build]
28+
name: upload release to PyPI
29+
runs-on: ubuntu-latest
30+
environment:
31+
name: release
32+
url: https://pypi.org/project/trio
33+
permissions:
34+
id-token: write
35+
36+
steps:
37+
- uses: actions/download-artifact@v4
38+
with:
39+
pattern: trio-*
40+
path: dist
41+
merge-multiple: true
42+
43+
- name: Publish package distributions to PyPI
44+
uses: pypa/gh-action-pypi-publish@release/v1

.pre-commit-config.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ci:
44
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
55
autoupdate_schedule: weekly
66
submodules: false
7+
skip: [regenerate-files]
78

89
repos:
910
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -19,11 +20,11 @@ repos:
1920
- id: sort-simple-yaml
2021
files: .pre-commit-config.yaml
2122
- repo: https://github.com/psf/black-pre-commit-mirror
22-
rev: 24.4.2
23+
rev: 24.8.0
2324
hooks:
2425
- id: black
2526
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: v0.5.1
27+
rev: v0.6.2
2728
hooks:
2829
- id: ruff
2930
types: [file]
@@ -33,3 +34,11 @@ repos:
3334
rev: v2.3.0
3435
hooks:
3536
- id: codespell
37+
- repo: local
38+
hooks:
39+
- id: regenerate-files
40+
name: regenerate generated files
41+
language: system
42+
entry: python src/trio/_tools/gen_exports.py
43+
pass_filenames: false
44+
files: ^src\/trio\/_core\/(_run|(_i(o_(common|epoll|kqueue|windows)|nstrumentation)))\.py$

check.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ fi
7878

7979
# Check pip compile is consistent
8080
echo "::group::Pip Compile - Tests"
81-
uv pip compile --no-strip-markers --python-version=3.8 test-requirements.in -o test-requirements.txt
81+
uv pip compile --universal --python-version=3.8 test-requirements.in -o test-requirements.txt
8282
echo "::endgroup::"
8383
echo "::group::Pip Compile - Docs"
84-
uv pip compile --no-strip-markers --python-version=3.8 docs-requirements.in -o docs-requirements.txt
84+
uv pip compile --universal --python-version=3.11 docs-requirements.in -o docs-requirements.txt
8585
echo "::endgroup::"
8686

8787
if git status --porcelain | grep -q "requirements.txt"; then
@@ -112,7 +112,7 @@ if [ $EXIT_STATUS -ne 0 ]; then
112112
Problems were found by static analysis (listed above).
113113
To fix formatting and see remaining errors, run
114114
115-
pip install -r test-requirements.txt
115+
uv pip install -r test-requirements.txt
116116
black src/trio
117117
ruff check src/trio
118118
./check.sh

ci.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,29 @@ python -c "import sys, struct, ssl; print('python:', sys.version); print('versio
3737
echo "::endgroup::"
3838

3939
echo "::group::Install dependencies"
40-
python -m pip install -U pip build
40+
python -m pip install -U pip uv -c test-requirements.txt
4141
python -m pip --version
42+
python -m uv --version
43+
44+
python -m uv pip install build
4245

4346
python -m build
44-
python -m pip install dist/*.whl
47+
wheel_package=$(ls dist/*.whl)
48+
python -m uv pip install "trio @ $wheel_package" -c test-requirements.txt
4549

4650
if [ "$CHECK_FORMATTING" = "1" ]; then
47-
python -m pip install -r test-requirements.txt
51+
python -m uv pip install -r test-requirements.txt exceptiongroup
4852
echo "::endgroup::"
4953
source check.sh
5054
else
5155
# Actual tests
5256
# expands to 0 != 1 if NO_TEST_REQUIREMENTS is not set, if set the `-0` has no effect
5357
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
54-
if [ ${NO_TEST_REQUIREMENTS-0} == 1 ]; then
55-
python -m pip install pytest coverage
58+
if [ "${NO_TEST_REQUIREMENTS-0}" == 1 ]; then
59+
python -m uv pip install pytest coverage -c test-requirements.txt
5660
flags="--skip-optional-imports"
5761
else
58-
python -m pip install -r test-requirements.txt
62+
python -m uv pip install -r test-requirements.txt
5963
flags=""
6064
fi
6165

@@ -118,7 +122,7 @@ else
118122
cd empty
119123

120124
INSTALLDIR=$(python -c "import os, trio; print(os.path.dirname(trio.__file__))")
121-
cp ../pyproject.toml $INSTALLDIR
125+
cp ../pyproject.toml "$INSTALLDIR"
122126

123127
# get mypy tests a nice cache
124128
MYPYPATH=".." mypy --config-file= --cache-dir=./.mypy_cache -c "import trio" >/dev/null 2>/dev/null || true
@@ -128,7 +132,7 @@ else
128132

129133
echo "::endgroup::"
130134
echo "::group:: Run Tests"
131-
if COVERAGE_PROCESS_START=$(pwd)/../pyproject.toml coverage run --rcfile=../pyproject.toml -m pytest -ra --junitxml=../test-results.xml --run-slow ${INSTALLDIR} --verbose --durations=10 $flags; then
135+
if COVERAGE_PROCESS_START=$(pwd)/../pyproject.toml coverage run --rcfile=../pyproject.toml -m pytest -ra --junitxml=../test-results.xml --run-slow "${INSTALLDIR}" --verbose --durations=10 $flags; then
132136
PASSED=true
133137
else
134138
PASSED=false

docs-requirements.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# sphinx 5.3 doesn't work with our _NoValue workaround
33
sphinx >= 6.0
44
jinja2
5-
sphinx_rtd_theme
5+
# >= is necessary to prevent `uv` from selecting a `Sphinx` version this does not support
6+
sphinx_rtd_theme >= 2
67
sphinxcontrib-jquery
78
sphinxcontrib-trio
89
towncrier

docs-requirements.txt

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
# This file was autogenerated by uv via the following command:
2-
# uv pip compile --no-strip-markers --python-version=3.8 docs-requirements.in -o docs-requirements.txt
3-
alabaster==0.7.13
2+
# uv pip compile --universal --python-version=3.11 docs-requirements.in -o docs-requirements.txt
3+
alabaster==0.7.16
44
# via sphinx
5-
attrs==23.2.0
5+
attrs==24.2.0
66
# via
77
# -r docs-requirements.in
88
# outcome
9-
babel==2.15.0
9+
babel==2.16.0
1010
# via sphinx
1111
beautifulsoup4==4.12.3
1212
# via sphinx-codeautolink
1313
certifi==2024.7.4
1414
# via requests
15-
cffi==1.16.0 ; platform_python_implementation != 'PyPy'
16-
# via cryptography
15+
cffi==1.17.0 ; platform_python_implementation != 'PyPy' or os_name == 'nt'
16+
# via
17+
# -r docs-requirements.in
18+
# cryptography
1719
charset-normalizer==3.3.2
1820
# via requests
1921
click==8.1.7
2022
# via towncrier
21-
cryptography==42.0.8
23+
colorama==0.4.6 ; sys_platform == 'win32' or platform_system == 'Windows'
24+
# via
25+
# click
26+
# sphinx
27+
cryptography==43.0.0
2228
# via pyopenssl
2329
docutils==0.20.1
2430
# via
2531
# sphinx
2632
# sphinx-rtd-theme
27-
exceptiongroup==1.2.1
33+
exceptiongroup==1.2.2
2834
# via -r docs-requirements.in
2935
idna==3.7
3036
# via
@@ -34,12 +40,6 @@ imagesize==1.4.1
3440
# via sphinx
3541
immutables==0.20
3642
# via -r docs-requirements.in
37-
importlib-metadata==8.0.0 ; python_version < '3.10'
38-
# via sphinx
39-
importlib-resources==6.4.0 ; python_version < '3.10'
40-
# via towncrier
41-
incremental==22.10.0
42-
# via towncrier
4343
jinja2==3.1.4
4444
# via
4545
# -r docs-requirements.in
@@ -51,14 +51,12 @@ outcome==1.3.0.post0
5151
# via -r docs-requirements.in
5252
packaging==24.1
5353
# via sphinx
54-
pycparser==2.22 ; platform_python_implementation != 'PyPy'
54+
pycparser==2.22 ; platform_python_implementation != 'PyPy' or os_name == 'nt'
5555
# via cffi
5656
pygments==2.18.0
5757
# via sphinx
58-
pyopenssl==24.1.0
58+
pyopenssl==24.2.1
5959
# via -r docs-requirements.in
60-
pytz==2024.1 ; python_version < '3.9'
61-
# via babel
6260
requests==2.32.3
6361
# via sphinx
6462
sniffio==1.3.1
@@ -67,9 +65,9 @@ snowballstemmer==2.2.0
6765
# via sphinx
6866
sortedcontainers==2.4.0
6967
# via -r docs-requirements.in
70-
soupsieve==2.5
68+
soupsieve==2.6
7169
# via beautifulsoup4
72-
sphinx==7.1.2
70+
sphinx==7.4.7
7371
# via
7472
# -r docs-requirements.in
7573
# sphinx-codeautolink
@@ -83,11 +81,11 @@ sphinx-hoverxref==1.4.0
8381
# via -r docs-requirements.in
8482
sphinx-rtd-theme==2.0.0
8583
# via -r docs-requirements.in
86-
sphinxcontrib-applehelp==1.0.4
84+
sphinxcontrib-applehelp==2.0.0
8785
# via sphinx
88-
sphinxcontrib-devhelp==1.0.2
86+
sphinxcontrib-devhelp==2.0.0
8987
# via sphinx
90-
sphinxcontrib-htmlhelp==2.0.1
88+
sphinxcontrib-htmlhelp==2.1.0
9189
# via sphinx
9290
sphinxcontrib-jquery==4.1
9391
# via
@@ -96,19 +94,13 @@ sphinxcontrib-jquery==4.1
9694
# sphinx-rtd-theme
9795
sphinxcontrib-jsmath==1.0.1
9896
# via sphinx
99-
sphinxcontrib-qthelp==1.0.3
97+
sphinxcontrib-qthelp==2.0.0
10098
# via sphinx
101-
sphinxcontrib-serializinghtml==1.1.5
99+
sphinxcontrib-serializinghtml==2.0.0
102100
# via sphinx
103101
sphinxcontrib-trio==1.1.2
104102
# via -r docs-requirements.in
105-
tomli==2.0.1 ; python_version < '3.11'
106-
# via towncrier
107-
towncrier==23.11.0
103+
towncrier==24.7.1
108104
# via -r docs-requirements.in
109105
urllib3==2.2.2
110106
# via requests
111-
zipp==3.19.2 ; python_version < '3.10'
112-
# via
113-
# importlib-metadata
114-
# importlib-resources

0 commit comments

Comments
 (0)