Skip to content

Commit

Permalink
Merge branch 'master' into from_thread_check_cancelled
Browse files Browse the repository at this point in the history
# Conflicts:
#	trio/_tests/test_threads.py
#	trio/_threads.py
#	trio/from_thread.py
  • Loading branch information
richardsheridan committed Sep 3, 2023
2 parents 5a10e9b + 1c15500 commit 7ec12a5
Show file tree
Hide file tree
Showing 209 changed files with 8,177 additions and 3,579 deletions.
15 changes: 11 additions & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[run]
branch=True
source=trio
# For some reason coverage recording doesn't work for ipython_custom_exc.py,
# so leave it out of reports
omit=
setup.py
*/ipython_custom_exc.py
# Omit the generated files in trio/_core starting with _public_
# These are run in subprocesses, but still don't work. We follow
# coverage's documentation to no avail.
*/trio/_core/_tests/test_multierror_scripts/*
# Omit the generated files in trio/_core starting with _generated_
*/trio/_core/_generated_*
# Script used to check type completeness that isn't run in tests
*/trio/_tests/check_type_completeness.py
# The test suite spawns subprocesses to test some stuff, so make sure
# this doesn't corrupt the coverage files
parallel=True
Expand All @@ -19,10 +21,15 @@ exclude_lines =
abc.abstractmethod
if TYPE_CHECKING:
if _t.TYPE_CHECKING:
if t.TYPE_CHECKING:
@overload
class .*\bProtocol\b.*\):

partial_branches =
pragma: no branch
if not TYPE_CHECKING:
if not _t.TYPE_CHECKING:
if not t.TYPE_CHECKING:
if .* or not TYPE_CHECKING:
if .* or not _t.TYPE_CHECKING:
if .* or not t.TYPE_CHECKING:
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# sorting all imports with isort
933f77b96f0092e1baab4474a9208fc2e379aa32
36 changes: 0 additions & 36 deletions .github/dependabot.yml

This file was deleted.

82 changes: 82 additions & 0 deletions .github/workflows/autodeps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Autodeps

on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *'

jobs:
Autodeps:
name: Autodeps
timeout-minutes: 10
runs-on: 'ubuntu-latest'
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#changing-github_token-permissions
permissions:
pull-requests: write
issues: write
repository-projects: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Bump dependencies
run: |
python -m pip install -U pip
python -m pip install -r test-requirements.txt
pip-compile -U test-requirements.in
pip-compile -U docs-requirements.in
- name: Black
run: |
# The new dependencies may contain a new black version.
# Commit any changes immediately.
python -m pip install -r test-requirements.txt
black setup.py trio
- name: Commit changes and create automerge PR
env:
GH_TOKEN: ${{ github.token }}
run: |
# setup git repo
git switch --force-create autodeps/bump_from_${GITHUB_SHA:0:6}
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
if ! git commit -am "Dependency updates"; then
echo "No changes to commit!"
exit 0
fi
git push --force --set-upstream origin autodeps/bump_from_${GITHUB_SHA:0:6}
# git push returns before github is ready for a pr, so we poll until success
for BACKOFF in 1 2 4 8 0; do
sleep $BACKOFF
if gh pr create \
--label dependencies --body "" \
--title "Bump dependencies from commit ${GITHUB_SHA:0:6}" \
; then
break
fi
done
if [ $BACKOFF -eq 0 ]; then
echo "Could not create the PR"
exit 1
fi
# gh pr create returns before the pr is ready, so we again poll until success
# https://github.com/cli/cli/issues/2619#issuecomment-1240543096
for BACKOFF in 1 2 4 8 0; do
sleep $BACKOFF
if gh pr merge --auto --squash; then
break
fi
done
if [ $BACKOFF -eq 0 ]; then
echo "Could not set automerge"
exit 1
fi
132 changes: 60 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- "dependabot/**"
pull_request:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && format('-{0}', github.sha) || '' }}
cancel-in-progress: true

jobs:
Windows:
name: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})'
Expand All @@ -14,11 +18,18 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10']
# pypy-3.10 is failing, see https://github.com/python-trio/trio/issues/2678
python: ['3.8', '3.9', '3.10', 'pypy-3.9-nightly'] #, 'pypy-3.10-nightly']
arch: ['x86', 'x64']
lsp: ['']
lsp_extract_file: ['']
extra_name: ['']
exclude:
# pypy does not release 32-bit binaries
- python: 'pypy-3.9-nightly'
arch: 'x86'
#- python: 'pypy-3.10-nightly'
# arch: 'x86'
include:
- python: '3.8'
arch: 'x64'
Expand All @@ -35,25 +46,29 @@ jobs:
# lsp: 'http://download.pctools.com/mirror/updates/9.0.0.2308-SDavfree-lite_en.exe'
# lsp_extract_file: ''
# extra_name: ', with non-IFS LSP'
- python: '3.8' # <- not actually used
arch: 'x64'
pypy_nightly_branch: 'py3.8'
extra_name: ', pypy 3.8 nightly'

continue-on-error: >-
${{
(
endsWith(matrix.python, '-dev')
|| endsWith(matrix.python, '-nightly')
)
&& true
|| false
}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
# This allows the matrix to specify just the major.minor version while still
# expanding it to get the latest patch version including alpha releases.
# This avoids the need to update for each new alpha, beta, release candidate,
# and then finally an actual release version. actions/setup-python doesn't
# support this for PyPy presently so we get no help there.
#
# CPython -> 3.9.0-alpha - 3.9.X
# PyPy -> pypy-3.7
# 'CPython' -> '3.9.0-alpha - 3.9.X'
# 'PyPy' -> 'pypy-3.9'
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
architecture: '${{ matrix.arch }}'
cache: pip
Expand All @@ -64,8 +79,13 @@ jobs:
env:
LSP: '${{ matrix.lsp }}'
LSP_EXTRACT_FILE: '${{ matrix.lsp_extract_file }}'
# Should match 'name:' up above
JOB_NAME: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})'
- if: always()
uses: codecov/codecov-action@v3
with:
directory: empty
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
name: Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})
flags: Windows,${{ matrix.python }}

Ubuntu:
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
Expand All @@ -74,29 +94,18 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['pypy-3.7', 'pypy-3.8', 'pypy-3.9', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']
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']
check_formatting: ['0']
pypy_nightly_branch: ['']
extra_name: ['']
include:
- python: '3.8'
check_formatting: '1'
extra_name: ', check formatting'
- python: '3.7' # <- not actually used
pypy_nightly_branch: 'py3.7'
extra_name: ', pypy 3.7 nightly'
- python: '3.8' # <- not actually used
pypy_nightly_branch: 'py3.8'
extra_name: ', pypy 3.8 nightly'
- python: '3.9' # <- not actually used
pypy_nightly_branch: 'py3.9'
extra_name: ', pypy 3.9 nightly'
continue-on-error: >-
${{
(
matrix.check_formatting == '1'
|| matrix.pypy_nightly_branch == 'py3.7'
|| endsWith(matrix.python, '-dev')
endsWith(matrix.python, '-dev')
|| endsWith(matrix.python, '-nightly')
)
&& true
|| false
Expand All @@ -105,7 +114,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
if: "!endsWith(matrix.python, '-dev')"
with:
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
Expand All @@ -119,71 +128,50 @@ jobs:
- name: Run tests
run: ./ci.sh
env:
PYPY_NIGHTLY_BRANCH: '${{ matrix.pypy_nightly_branch }}'
CHECK_FORMATTING: '${{ matrix.check_formatting }}'
# Should match 'name:' up above
JOB_NAME: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'

autofmt:
name: Autoformat dependabot PR
timeout-minutes: 10
if: github.actor == 'dependabot[bot]'
runs-on: 'ubuntu-latest'
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#changing-github_token-permissions
permissions:
pull-requests: write
issues: write
repository-projects: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup python
uses: actions/setup-python@v2
- if: always()
uses: codecov/codecov-action@v3
with:
python-version: "3.8"
- name: Check formatting
run: |
python -m pip install -r test-requirements.txt
./check.sh
- name: Commit autoformatter changes
if: failure()
run: |
black setup.py trio
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git commit -am "Autoformatter changes"
git push
directory: empty
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})
flags: Ubuntu,${{ matrix.python }}

macOS:
name: 'macOS (${{ matrix.python }})'
timeout-minutes: 10
timeout-minutes: 15
runs-on: 'macos-latest'
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10']
include:
- python: '3.8' # <- not actually used
arch: 'x64'
pypy_nightly_branch: 'py3.8'
extra_name: ', pypy 3.8 nightly'
python: ['3.8', '3.9', '3.10', 'pypy-3.9-nightly', 'pypy-3.10-nightly']
continue-on-error: >-
${{
(
endsWith(matrix.python, '-dev')
|| endsWith(matrix.python, '-nightly')
)
&& true
|| false
}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
cache: pip
cache-dependency-path: test-requirements.txt
- name: Run tests
run: ./ci.sh
env:
# Should match 'name:' up above
JOB_NAME: 'macOS (${{ matrix.python }})'
- if: always()
uses: codecov/codecov-action@v3
with:
directory: empty
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
name: macOS (${{ matrix.python }})
flags: macOS,${{ matrix.python }}

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

0 comments on commit 7ec12a5

Please sign in to comment.