Skip to content

Commit

Permalink
Merge branch 'master' into graingert-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
A5rocks authored Nov 7, 2023
2 parents d7395e9 + 7b673d4 commit c1bafb9
Show file tree
Hide file tree
Showing 24 changed files with 406 additions and 392 deletions.
82 changes: 48 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,65 @@ on:
jobs:
Windows:
name: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})'
timeout-minutes: 20
timeout-minutes: 30
runs-on: 'windows-latest'
strategy:
fail-fast: false
matrix:
python: ['3.6', '3.7', '3.8', '3.9']
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
arch: ['x86', 'x64']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '${{ matrix.python }}'
# 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
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
cache-dependency-path: test-requirements.txt
- name: Run tests
run: ./ci.sh
shell: bash
env:
# 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
name: Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})
flags: Windows,${{ matrix.python }}

Ubuntu:
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
timeout-minutes: 10
timeout-minutes: 20
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
# No pypy-3.7 because Trio doesn't support it (nightly is fine, it has a fix we need)
python: ['pypy-3.6', '3.6', '3.7', '3.8', '3.9', '3.6-dev', '3.7-dev', '3.8-dev', '3.9-dev']
python: ['pypy-3.9', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.9-nightly']
check_formatting: ['0']
check_docs: ['0']
pypy_nightly_branch: ['']
extra_name: ['']
include:
- python: '3.8'
- python: '3.11'
check_formatting: '1'
extra_name: ', check formatting'
# pypy3.7-nightly produces an "OSError: handle is closed" in the
# bowels of multiprocessing after all tests appear to complete successfully
# - python: '3.7' # <- not actually used
# pypy_nightly_branch: 'py3.7'
# extra_name: ', pypy 3.7 nightly'
steps:
- name: Checkout
uses: actions/checkout@v2
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: '${{ matrix.python }}'
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: Setup python (dev)
uses: deadsnakes/action@v2.0.2
if: endsWith(matrix.python, '-dev')
Expand All @@ -76,29 +83,36 @@ jobs:
- name: Run tests
run: ./ci.sh
env:
PYPY_NIGHTLY_BRANCH: '${{ matrix.pypy_nightly_branch }}'
CHECK_FORMATTING: '${{ matrix.check_formatting }}'
CHECK_DOCS: '${{ matrix.check_docs }}'
# Should match 'name:' up above
JOB_NAME: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
- if: always()
uses: codecov/codecov-action@v3
with:
directory: empty
name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})
flags: Ubuntu,${{ matrix.python }}

macOS:
name: 'macOS (${{ matrix.python }})'
timeout-minutes: 10
timeout-minutes: 20
runs-on: 'macos-latest'
strategy:
fail-fast: false
matrix:
python: ['3.6', '3.7', '3.8', '3.9']
python: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.9-nightly']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '${{ matrix.python }}'
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
name: macOS (${{ matrix.python }})
flags: macOS,${{ matrix.python }}
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ formats:
- htmlzip
- epub

build:
os: "ubuntu-22.04"
tools:
python: "3.11"

python:
version: 3.7
install:
- requirements: docs-requirements.txt

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
**trio-asyncio** is a re-implementation of the ``asyncio`` mainloop on top of
Trio.

Trio-Asyncio requires at least Python 3.6. It is tested on recent versions of
3.6, 3.7, 3.8, and nightly.
Trio-Asyncio requires at least Python 3.7. It is tested on recent versions of
3.7 through 3.11, plus 3.12-dev.

+++++++++++
Rationale
Expand Down
55 changes: 3 additions & 52 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,6 @@ function curl-harder() {
return 1
}

################################################################
# Bootstrap python environment, if necessary
################################################################

### PyPy nightly (currently on Travis) ###

if [ "$PYPY_NIGHTLY_BRANCH" != "" ]; then
JOB_NAME="pypy_nightly_${PYPY_NIGHTLY_BRANCH}"
curl-harder -o pypy.tar.bz2 http://buildbot.pypy.org/nightly/${PYPY_NIGHTLY_BRANCH}/pypy-c-jit-latest-linux64.tar.bz2
if [ ! -s pypy.tar.bz2 ]; then
# We know:
# - curl succeeded (200 response code)
# - nonetheless, pypy.tar.bz2 does not exist, or contains no data
# This isn't going to work, and the failure is not informative of
# anything involving Trio.
ls -l
echo "PyPy3 nightly build failed to download – something is wrong on their end."
echo "Skipping testing against the nightly build for right now."
exit 0
fi
tar xaf pypy.tar.bz2
# something like "pypy-c-jit-89963-748aa3022295-linux64"
PYPY_DIR=$(echo pypy-c-jit-*)
PYTHON_EXE=$PYPY_DIR/bin/pypy3

if ! ($PYTHON_EXE -m ensurepip \
&& $PYTHON_EXE -m pip install virtualenv \
&& $PYTHON_EXE -m virtualenv testenv); then
echo "pypy nightly is broken; skipping tests"
exit 0
fi
source testenv/bin/activate
fi

################################################################
# We have a Python environment!
################################################################
Expand All @@ -69,16 +35,7 @@ python -c "import sys, struct, ssl; print('#' * 70); print('python:', sys.versio
python -m pip install -U pip setuptools wheel
python -m pip --version

python setup.py sdist --formats=zip
python -m pip install dist/*.zip

if python -c 'import sys; sys.exit(sys.version_info >= (3, 7))'; then
# Python < 3.7, select last ipython with 3.6 support
# macOS requires the suffix for --in-place or you get an undefined label error
sed -i'.bak' 's/ipython==[^ ]*/ipython==7.16.1/' test-requirements.txt
sed -i'.bak' 's/traitlets==[^ ]*/traitlets==4.3.3/' test-requirements.txt
git diff test-requirements.txt
fi
python -m pip install .

# See https://github.com/python-trio/trio/issues/334
YAPF_VERSION=0.20.0
Expand Down Expand Up @@ -113,6 +70,8 @@ else
mkdir empty || true
cd empty

cp ../pyproject.toml ../tests/

# We have to copy .coveragerc into this directory, rather than passing
# --cov-config=../.coveragerc to pytest, because codecov.sh will run
# 'coverage xml' to generate the report that it uses, and that will only
Expand All @@ -124,13 +83,5 @@ else
PASSED=false
fi

# The codecov docs recommend something like 'bash <(curl ...)' to pipe the
# script directly into bash as its being downloaded. But, the codecov
# server is flaky, so we instead save to a temp file with retries, and
# wait until we've successfully fetched the whole script before trying to
# run it.
curl-harder -o codecov.sh https://codecov.io/bash
bash codecov.sh -n "${JOB_NAME}"

$PASSED
fi
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ asyncio libraries such as ``home-assistant``.
Helpful facts:

* Supported environments: Linux, MacOS, or Windows running some kind of Python
3.6-or-better (either CPython or PyPy3 is fine). \*BSD and illumOS likely
3.7-or-better (either CPython or PyPy3 is fine). \*BSD and illumOS likely
work too, but are untested.

* Install: ``python3 -m pip install -U trio-asyncio`` (or on Windows, maybe
Expand Down
2 changes: 2 additions & 0 deletions newsfragments/121.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
``trio-asyncio`` now requires Trio 0.22 and does not produce deprecation warnings.
Python 3.12 is now supported. Python 3.6 and 3.7 are no longer supported.
5 changes: 5 additions & 0 deletions newsfragments/123.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trio-asyncio now indicates its presence to `sniffio` using the
``sniffio.thread_local`` interface that is preferred since sniffio
v1.3.0. This should be less likely than the previous approach to cause
:func:`sniffio.current_async_library` to return incorrect results due
to unintended inheritance of contextvars.
17 changes: 17 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
[tool.pytest.ini_options]
addopts = ["-p", "no:asyncio"]
filterwarnings = [
"error",
"ignore:The loop argument is deprecated since Python 3.8:DeprecationWarning",
'ignore:"@coroutine" decorator is deprecated since Python 3.8:DeprecationWarning',
"default:Tried to add marker .* but that test doesn't exist.:RuntimeWarning",
"ignore:the imp module is deprecated in favour of importlib.*:DeprecationWarning",
"ignore:'AbstractChildWatcher' is deprecated.*:DeprecationWarning"
]
junit_family = "xunit2"
xfail_strict = true

[tool.flake8]
max-line-length = 99
extend-ignore = ['D', 'E402', 'E731', 'E127', 'E502', 'E123', 'W503']

[tool.towncrier]
package = "trio_asyncio"
title_format = "trio-asyncio {version} ({project_date})"
Expand Down
10 changes: 0 additions & 10 deletions setup.cfg

This file was deleted.

27 changes: 13 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
code (asyncio: ~8000) but passes the complete Python 3.6 test suite with no
errors.
``trio_asyncio`` requires Python 3.6 or better.
``trio_asyncio`` requires Python 3.7 or better.
Author
======
Expand All @@ -52,15 +52,6 @@
"""

install_requires = [
"trio >= 0.15.0",
"outcome",
"sniffio",
]
if sys.version_info < (3, 7):
install_requires.append("contextvars >= 2.1")
install_requires.append("async_generator >= 1.6")

setup(
name="trio_asyncio",
version=__version__, # noqa: F821
Expand All @@ -71,11 +62,16 @@
url="https://github.com/python-trio/trio-asyncio",
license="MIT -or- Apache License 2.0",
packages=["trio_asyncio"],
install_requires=install_requires,
install_requires=[
"trio >= 0.22.0",
"outcome",
"sniffio >= 1.3.0",
"exceptiongroup >= 1.0.0; python_version < '3.11'",
],
# This means, just install *everything* you see under trio/, even if it
# doesn't look like a source file, so long as it appears in MANIFEST.in:
include_package_data=True,
python_requires=">=3.6", # temporary, for RTD
python_requires=">=3.7",
keywords=["async", "io", "trio", "asyncio", "trio-asyncio"],
setup_requires=['pytest-runner'],
tests_require=['pytest >= 5.4', 'pytest-trio >= 0.6', 'outcome'],
Expand All @@ -91,8 +87,11 @@
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: System :: Networking",
"Framework :: Trio",
"Framework :: AsyncIO",
Expand Down
Loading

0 comments on commit c1bafb9

Please sign in to comment.