Skip to content

Commit a09aa84

Browse files
Merge branch 'master' into from_thread_check_cancelled
# Conflicts: # trio/_tests/test_threads.py # trio/_threads.py # trio/from_thread.py
2 parents 5a10e9b + 1c15500 commit a09aa84

File tree

209 files changed

+8172
-3579
lines changed

Some content is hidden

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

209 files changed

+8172
-3579
lines changed

.coveragerc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
[run]
22
branch=True
33
source=trio
4-
# For some reason coverage recording doesn't work for ipython_custom_exc.py,
5-
# so leave it out of reports
64
omit=
75
setup.py
8-
*/ipython_custom_exc.py
9-
# Omit the generated files in trio/_core starting with _public_
6+
# These are run in subprocesses, but still don't work. We follow
7+
# coverage's documentation to no avail.
8+
*/trio/_core/_tests/test_multierror_scripts/*
9+
# Omit the generated files in trio/_core starting with _generated_
1010
*/trio/_core/_generated_*
11+
# Script used to check type completeness that isn't run in tests
12+
*/trio/_tests/check_type_completeness.py
1113
# The test suite spawns subprocesses to test some stuff, so make sure
1214
# this doesn't corrupt the coverage files
1315
parallel=True
@@ -19,10 +21,15 @@ exclude_lines =
1921
abc.abstractmethod
2022
if TYPE_CHECKING:
2123
if _t.TYPE_CHECKING:
24+
if t.TYPE_CHECKING:
25+
@overload
26+
class .*\bProtocol\b.*\):
2227

2328
partial_branches =
2429
pragma: no branch
2530
if not TYPE_CHECKING:
2631
if not _t.TYPE_CHECKING:
32+
if not t.TYPE_CHECKING:
2733
if .* or not TYPE_CHECKING:
2834
if .* or not _t.TYPE_CHECKING:
35+
if .* or not t.TYPE_CHECKING:

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# sorting all imports with isort
2+
933f77b96f0092e1baab4474a9208fc2e379aa32

.github/dependabot.yml

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

.github/workflows/autodeps.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Autodeps
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 1 * *'
7+
8+
jobs:
9+
Autodeps:
10+
name: Autodeps
11+
timeout-minutes: 10
12+
runs-on: 'ubuntu-latest'
13+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#changing-github_token-permissions
14+
permissions:
15+
pull-requests: write
16+
issues: write
17+
repository-projects: write
18+
contents: write
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
- name: Setup python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: "3.8"
26+
- name: Bump dependencies
27+
run: |
28+
python -m pip install -U pip
29+
python -m pip install -r test-requirements.txt
30+
pip-compile -U test-requirements.in
31+
pip-compile -U docs-requirements.in
32+
- name: Black
33+
run: |
34+
# The new dependencies may contain a new black version.
35+
# Commit any changes immediately.
36+
python -m pip install -r test-requirements.txt
37+
black setup.py trio
38+
- name: Commit changes and create automerge PR
39+
env:
40+
GH_TOKEN: ${{ github.token }}
41+
run: |
42+
# setup git repo
43+
git switch --force-create autodeps/bump_from_${GITHUB_SHA:0:6}
44+
git config user.name 'github-actions[bot]'
45+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
46+
47+
if ! git commit -am "Dependency updates"; then
48+
echo "No changes to commit!"
49+
exit 0
50+
fi
51+
52+
git push --force --set-upstream origin autodeps/bump_from_${GITHUB_SHA:0:6}
53+
54+
# git push returns before github is ready for a pr, so we poll until success
55+
for BACKOFF in 1 2 4 8 0; do
56+
sleep $BACKOFF
57+
if gh pr create \
58+
--label dependencies --body "" \
59+
--title "Bump dependencies from commit ${GITHUB_SHA:0:6}" \
60+
; then
61+
break
62+
fi
63+
done
64+
65+
if [ $BACKOFF -eq 0 ]; then
66+
echo "Could not create the PR"
67+
exit 1
68+
fi
69+
70+
# gh pr create returns before the pr is ready, so we again poll until success
71+
# https://github.com/cli/cli/issues/2619#issuecomment-1240543096
72+
for BACKOFF in 1 2 4 8 0; do
73+
sleep $BACKOFF
74+
if gh pr merge --auto --squash; then
75+
break
76+
fi
77+
done
78+
79+
if [ $BACKOFF -eq 0 ]; then
80+
echo "Could not set automerge"
81+
exit 1
82+
fi

.github/workflows/ci.yml

Lines changed: 60 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- "dependabot/**"
77
pull_request:
88

9+
concurrency:
10+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && format('-{0}', github.sha) || '' }}
11+
cancel-in-progress: true
12+
913
jobs:
1014
Windows:
1115
name: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})'
@@ -14,11 +18,18 @@ jobs:
1418
strategy:
1519
fail-fast: false
1620
matrix:
17-
python: ['3.7', '3.8', '3.9', '3.10']
21+
# pypy-3.10 is failing, see https://github.com/python-trio/trio/issues/2678
22+
python: ['3.8', '3.9', '3.10', 'pypy-3.9-nightly'] #, 'pypy-3.10-nightly']
1823
arch: ['x86', 'x64']
1924
lsp: ['']
2025
lsp_extract_file: ['']
2126
extra_name: ['']
27+
exclude:
28+
# pypy does not release 32-bit binaries
29+
- python: 'pypy-3.9-nightly'
30+
arch: 'x86'
31+
#- python: 'pypy-3.10-nightly'
32+
# arch: 'x86'
2233
include:
2334
- python: '3.8'
2435
arch: 'x64'
@@ -35,25 +46,29 @@ jobs:
3546
# lsp: 'http://download.pctools.com/mirror/updates/9.0.0.2308-SDavfree-lite_en.exe'
3647
# lsp_extract_file: ''
3748
# extra_name: ', with non-IFS LSP'
38-
- python: '3.8' # <- not actually used
39-
arch: 'x64'
40-
pypy_nightly_branch: 'py3.8'
41-
extra_name: ', pypy 3.8 nightly'
42-
49+
continue-on-error: >-
50+
${{
51+
(
52+
endsWith(matrix.python, '-dev')
53+
|| endsWith(matrix.python, '-nightly')
54+
)
55+
&& true
56+
|| false
57+
}}
4358
steps:
4459
- name: Checkout
4560
uses: actions/checkout@v3
4661
- name: Setup python
47-
uses: actions/setup-python@v2
62+
uses: actions/setup-python@v4
4863
with:
4964
# This allows the matrix to specify just the major.minor version while still
5065
# expanding it to get the latest patch version including alpha releases.
5166
# This avoids the need to update for each new alpha, beta, release candidate,
5267
# and then finally an actual release version. actions/setup-python doesn't
5368
# support this for PyPy presently so we get no help there.
5469
#
55-
# CPython -> 3.9.0-alpha - 3.9.X
56-
# PyPy -> pypy-3.7
70+
# 'CPython' -> '3.9.0-alpha - 3.9.X'
71+
# 'PyPy' -> 'pypy-3.9'
5772
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
5873
architecture: '${{ matrix.arch }}'
5974
cache: pip
@@ -64,8 +79,13 @@ jobs:
6479
env:
6580
LSP: '${{ matrix.lsp }}'
6681
LSP_EXTRACT_FILE: '${{ matrix.lsp_extract_file }}'
67-
# Should match 'name:' up above
68-
JOB_NAME: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})'
82+
- if: always()
83+
uses: codecov/codecov-action@v3
84+
with:
85+
directory: empty
86+
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
87+
name: Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})
88+
flags: Windows,${{ matrix.python }}
6989

7090
Ubuntu:
7191
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
@@ -74,29 +94,18 @@ jobs:
7494
strategy:
7595
fail-fast: false
7696
matrix:
77-
python: ['pypy-3.7', 'pypy-3.8', 'pypy-3.9', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']
97+
python: ['pypy-3.9', 'pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12-dev', 'pypy-3.9-nightly', 'pypy-3.10-nightly']
7898
check_formatting: ['0']
79-
pypy_nightly_branch: ['']
8099
extra_name: ['']
81100
include:
82101
- python: '3.8'
83102
check_formatting: '1'
84103
extra_name: ', check formatting'
85-
- python: '3.7' # <- not actually used
86-
pypy_nightly_branch: 'py3.7'
87-
extra_name: ', pypy 3.7 nightly'
88-
- python: '3.8' # <- not actually used
89-
pypy_nightly_branch: 'py3.8'
90-
extra_name: ', pypy 3.8 nightly'
91-
- python: '3.9' # <- not actually used
92-
pypy_nightly_branch: 'py3.9'
93-
extra_name: ', pypy 3.9 nightly'
94104
continue-on-error: >-
95105
${{
96106
(
97-
matrix.check_formatting == '1'
98-
|| matrix.pypy_nightly_branch == 'py3.7'
99-
|| endsWith(matrix.python, '-dev')
107+
endsWith(matrix.python, '-dev')
108+
|| endsWith(matrix.python, '-nightly')
100109
)
101110
&& true
102111
|| false
@@ -105,7 +114,7 @@ jobs:
105114
- name: Checkout
106115
uses: actions/checkout@v3
107116
- name: Setup python
108-
uses: actions/setup-python@v2
117+
uses: actions/setup-python@v4
109118
if: "!endsWith(matrix.python, '-dev')"
110119
with:
111120
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
@@ -119,71 +128,50 @@ jobs:
119128
- name: Run tests
120129
run: ./ci.sh
121130
env:
122-
PYPY_NIGHTLY_BRANCH: '${{ matrix.pypy_nightly_branch }}'
123131
CHECK_FORMATTING: '${{ matrix.check_formatting }}'
124-
# Should match 'name:' up above
125-
JOB_NAME: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
126-
127-
autofmt:
128-
name: Autoformat dependabot PR
129-
timeout-minutes: 10
130-
if: github.actor == 'dependabot[bot]'
131-
runs-on: 'ubuntu-latest'
132-
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#changing-github_token-permissions
133-
permissions:
134-
pull-requests: write
135-
issues: write
136-
repository-projects: write
137-
contents: write
138-
steps:
139-
- name: Checkout
140-
uses: actions/checkout@v3
141-
with:
142-
ref: ${{ github.event.pull_request.head.ref }}
143-
- name: Setup python
144-
uses: actions/setup-python@v2
132+
- if: always()
133+
uses: codecov/codecov-action@v3
145134
with:
146-
python-version: "3.8"
147-
- name: Check formatting
148-
run: |
149-
python -m pip install -r test-requirements.txt
150-
./check.sh
151-
- name: Commit autoformatter changes
152-
if: failure()
153-
run: |
154-
black setup.py trio
155-
git config user.name 'github-actions[bot]'
156-
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
157-
git commit -am "Autoformatter changes"
158-
git push
135+
directory: empty
136+
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
137+
name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})
138+
flags: Ubuntu,${{ matrix.python }}
159139

160140
macOS:
161141
name: 'macOS (${{ matrix.python }})'
162-
timeout-minutes: 10
142+
timeout-minutes: 15
163143
runs-on: 'macos-latest'
164144
strategy:
165145
fail-fast: false
166146
matrix:
167-
python: ['3.7', '3.8', '3.9', '3.10']
168-
include:
169-
- python: '3.8' # <- not actually used
170-
arch: 'x64'
171-
pypy_nightly_branch: 'py3.8'
172-
extra_name: ', pypy 3.8 nightly'
147+
python: ['3.8', '3.9', '3.10', 'pypy-3.9-nightly', 'pypy-3.10-nightly']
148+
continue-on-error: >-
149+
${{
150+
(
151+
endsWith(matrix.python, '-dev')
152+
|| endsWith(matrix.python, '-nightly')
153+
)
154+
&& true
155+
|| false
156+
}}
173157
steps:
174158
- name: Checkout
175159
uses: actions/checkout@v3
176160
- name: Setup python
177-
uses: actions/setup-python@v2
161+
uses: actions/setup-python@v4
178162
with:
179163
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
180164
cache: pip
181165
cache-dependency-path: test-requirements.txt
182166
- name: Run tests
183167
run: ./ci.sh
184-
env:
185-
# Should match 'name:' up above
186-
JOB_NAME: 'macOS (${{ matrix.python }})'
168+
- if: always()
169+
uses: codecov/codecov-action@v3
170+
with:
171+
directory: empty
172+
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
173+
name: macOS (${{ matrix.python }})
174+
flags: macOS,${{ matrix.python }}
187175

188176
# https://github.com/marketplace/actions/alls-green#why
189177
check: # This job does nothing and is only used for the branch protection

0 commit comments

Comments
 (0)