Skip to content

Commit

Permalink
Merge branch 'master' into m1-macos-runs
Browse files Browse the repository at this point in the history
  • Loading branch information
A5rocks authored Apr 26, 2024
2 parents c686d4e + b4c19bc commit 811d289
Show file tree
Hide file tree
Showing 42 changed files with 885 additions and 668 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/autodeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ jobs:
python-version: "3.8"
- name: Bump dependencies
run: |
python -m pip install -U pip
python -m pip install -U pip pre-commit
python -m pip install -r test-requirements.txt
pip-compile -U test-requirements.in
pip-compile -U docs-requirements.in
pre-commit autoupdate --jobs 0
- name: Black
run: |
# The new dependencies may contain a new black version.
Expand Down
48 changes: 38 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,11 @@ jobs:
strategy:
fail-fast: false
matrix:
# pypy 3.9 and 3.10 are failing, see https://github.com/python-trio/trio/issues/2678 and https://github.com/python-trio/trio/issues/2776 respectively
python: ['3.8', '3.9', '3.10'] #, 'pypy-3.9-nightly', 'pypy-3.10-nightly']
python: ['3.8', '3.9', '3.10']
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 Down Expand Up @@ -94,7 +87,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['pypy-3.9', 'pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.9-nightly', 'pypy-3.10-nightly']
python: ['pypy-3.9', 'pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12']
check_formatting: ['0']
no_test_requirements: ['0']
extra_name: ['']
Expand Down Expand Up @@ -150,7 +143,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.9', '3.10', 'pypy-3.9-nightly', 'pypy-3.10-nightly']
python: ['3.8', '3.9', '3.10']
continue-on-error: >-
${{
(
Expand Down Expand Up @@ -204,6 +197,40 @@ jobs:
name: Alpine
flags: Alpine,3.12

Cython:
name: "Cython"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.12']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '${{ matrix.python }}'
cache: pip
# setuptools is needed to get distutils on 3.12, which cythonize requires
- name: install trio and setuptools
run: python -m pip install --upgrade pip . setuptools

- name: install cython<3
run: python -m pip install "cython<3"
- name: compile pyx file
run: cythonize -i tests/cython/test_cython.pyx
- name: import & run module
run: python -c 'import tests.cython.test_cython'

- name: install cython>=3
run: python -m pip install "cython>=3"
- name: compile pyx file
# different cython version should trigger a re-compile, but --force just in case
run: cythonize --inplace --force tests/cython/test_cython.pyx
- name: import & run module
run: python -c 'import tests.cython.test_cython'

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

Expand All @@ -214,6 +241,7 @@ jobs:
- Ubuntu
- macOS
- Alpine
- Cython

runs-on: ubuntu-latest

Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -19,11 +19,11 @@ repos:
- id: sort-simple-yaml
files: .pre-commit-config.yaml
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
rev: 24.4.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
rev: v0.4.1
hooks:
- id: ruff
types: [file]
Expand Down
65 changes: 0 additions & 65 deletions LONG_DESCRIPTION.rst

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include LICENSE LICENSE.MIT LICENSE.APACHE2
include README.rst
include LONG_DESCRIPTION.rst
include CODE_OF_CONDUCT.md CONTRIBUTING.md
include test-requirements.txt
include src/trio/py.typed
Expand Down
12 changes: 1 addition & 11 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,8 @@ fi

codespell || EXIT_STATUS=$?

PYRIGHT=0
echo "::group::Pyright interface tests"
pyright --verifytypes --ignoreexternal --pythonplatform=Linux --verifytypes=trio \
|| { echo "* Pyright --verifytypes (Linux) found errors." >> "$GITHUB_STEP_SUMMARY"; PYRIGHT=1; }
pyright --verifytypes --ignoreexternal --pythonplatform=Darwin --verifytypes=trio \
|| { echo "* Pyright --verifytypes (Mac) found errors." >> "$GITHUB_STEP_SUMMARY"; PYRIGHT=1; }
pyright --verifytypes --ignoreexternal --pythonplatform=Windows --verifytypes=trio \
|| { echo "* Pyright --verifytypes (Windows) found errors." >> "$GITHUB_STEP_SUMMARY"; PYRIGHT=1; }
if [ $PYRIGHT -ne 0 ]; then
echo "::error:: Pyright --verifytypes returned errors."
EXIT_STATUS=1
fi
python src/trio/_tests/check_type_completeness.py || EXIT_STATUS=$?

pyright src/trio/_tests/type_tests || EXIT_STATUS=$?
pyright src/trio/_core/_tests/type_tests || EXIT_STATUS=$?
Expand Down
18 changes: 9 additions & 9 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ charset-normalizer==3.3.2
# via requests
click==8.1.7
# via towncrier
cryptography==42.0.2
cryptography==42.0.5
# via pyopenssl
docutils==0.20.1
# via
Expand All @@ -36,9 +36,9 @@ imagesize==1.4.1
# via sphinx
immutables==0.20
# via -r docs-requirements.in
importlib-metadata==7.0.1
importlib-metadata==7.1.0
# via sphinx
importlib-resources==6.1.1
importlib-resources==6.4.0
# via towncrier
incremental==22.10.0
# via towncrier
Expand All @@ -51,19 +51,19 @@ markupsafe==2.1.5
# via jinja2
outcome==1.3.0.post0
# via -r docs-requirements.in
packaging==23.2
packaging==24.0
# via sphinx
pycparser==2.21
pycparser==2.22
# via cffi
pygments==2.17.2
# via sphinx
pyopenssl==24.0.0
pyopenssl==24.1.0
# via -r docs-requirements.in
pytz==2024.1
# via babel
requests==2.31.0
# via sphinx
sniffio==1.3.0
sniffio==1.3.1
# via -r docs-requirements.in
snowballstemmer==2.2.0
# via sphinx
Expand Down Expand Up @@ -99,9 +99,9 @@ tomli==2.0.1
# via towncrier
towncrier==23.11.0
# via -r docs-requirements.in
urllib3==2.2.0
urllib3==2.2.1
# via requests
zipp==3.17.0
zipp==3.18.1
# via
# importlib-metadata
# importlib-resources
9 changes: 6 additions & 3 deletions docs/source/awesome-trio-libraries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,27 @@ RPC
Testing
-------
* `pytest-trio <https://github.com/python-trio/pytest-trio>`__ - Pytest plugin for trio.
* `hypothesis-trio <https://github.com/python-trio/hypothesis-trio>`__ - Hypothesis plugin for trio.
* `hypothesis-trio <https://github.com/python-trio/hypothesis-trio>`__ - Hypothesis supports Trio out of the box for
``@given(...)`` tests; this extension provides Trio-compatible stateful testing.
* `trustme <https://github.com/python-trio/trustme>`__ - #1 quality TLS certs while you wait, for the discerning tester.
* `pytest-aio <https://github.com/klen/pytest-aio>`_ - Pytest plugin with support for trio, curio, asyncio
* `logot <https://github.com/etianen/logot>`_ - Test whether your async code is logging correctly.


Tools and Utilities
-------------------
* `trio-typing <https://github.com/python-trio/trio-typing>`__ - Type hints for Trio and related projects.
* `trio-util <https://github.com/groove-x/trio-util>`__ - An assortment of utilities for the Trio async/await framework.
* `flake8-trio <https://github.com/Zac-HD/flake8-trio>`__ - Highly opinionated linter for various sorts of problems in Trio and/or AnyIO. Can run as a flake8 plugin, or standalone with support for autofixing some errors.
* `tricycle <https://github.com/oremanj/tricycle>`__ - This is a library of interesting-but-maybe-not-yet-fully-proven extensions to Trio.
* `tenacity <https://github.com/jd/tenacity>`__ - Retrying library for Python with async/await support.
* `perf-timer <https://github.com/belm0/perf-timer>`__ - A code timer with Trio async support (see ``TrioPerfTimer``). Collects execution time of a block of code excluding time when the coroutine isn't scheduled, such as during blocking I/O and sleep. Also offers ``trio_perf_counter()`` for low-level timing.
* `aiometer <https://github.com/florimondmanca/aiometer>`__ - Execute lots of tasks concurrently while controlling concurrency limits
* `triotp <https://linkdd.github.io/triotp>`__ - OTP framework for Python Trio
* `aioresult <https://github.com/arthur-tacca/aioresult>`__ - Get the return value of a background async function in Trio or anyio, along with a simple Future class and wait utilities


Trio/Asyncio Interoperability
-----------------------------
* `anyio <https://github.com/agronholm/anyio>`__ - AnyIO is a asynchronous compatibility API that allows applications and libraries written against it to run unmodified on asyncio, curio and trio.
* `anyio <https://github.com/agronholm/anyio>`__ - AnyIO is a asynchronous compatibility API that allows applications and libraries written against it to run unmodified on asyncio or trio.
* `sniffio <https://github.com/python-trio/sniffio>`__ - This is a tiny package whose only purpose is to let you detect which async library your code is running under.
* `trio-asyncio <https://github.com/python-trio/trio-asyncio>`__ - Trio-Asyncio lets you use many asyncio libraries from your Trio app.
2 changes: 1 addition & 1 deletion docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ Documentation is hosted at `Read the Docs
rebuilding it after every commit.

For docstrings, we use `the Google docstring format
<https://www.sphinx-doc.org/en/3.x/usage/extensions/example_google.html#example-google-style-python-docstrings>`__.
<https://www.sphinx-doc.org/en/master/usage/extensions/example_google.html#example-google-style-python-docstrings>`__.
If you add a new function or class, there's no mechanism for
automatically adding that to the docs: you'll have to at least add a
line like ``.. autofunction:: <your function>`` in the appropriate
Expand Down
41 changes: 41 additions & 0 deletions docs/source/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,47 @@ Release history

.. towncrier release notes start
Trio 0.25.0 (2024-03-17)
------------------------

Breaking changes
~~~~~~~~~~~~~~~~

- The :ref:`strict_exception_groups <strict_exception_groups>` parameter now defaults to `True` in `trio.run` and `trio.lowlevel.start_guest_run`. `trio.open_nursery` still defaults to the same value as was specified in `trio.run`/`trio.lowlevel.start_guest_run`, but if you didn't specify it there then all subsequent calls to `trio.open_nursery` will change.
This is unfortunately very tricky to change with a deprecation period, as raising a `DeprecationWarning` whenever :ref:`strict_exception_groups <strict_exception_groups>` is not specified would raise a lot of unnecessary warnings.

Notable side effects of changing code to run with ``strict_exception_groups==True``

* If an iterator raises `StopAsyncIteration` or `StopIteration` inside a nursery, then python will not recognize wrapped instances of those for stopping iteration.
* `trio.run_process` is now documented that it can raise an `ExceptionGroup`. It previously could do this in very rare circumstances, but with :ref:`strict_exception_groups <strict_exception_groups>` set to `True` it will now do so whenever exceptions occur in ``deliver_cancel`` or with problems communicating with the subprocess.

* Errors in opening the process is now done outside the internal nursery, so if code previously ran with ``strict_exception_groups=True`` there are cases now where an `ExceptionGroup` is *no longer* added.
* `trio.TrioInternalError` ``.__cause__`` might be wrapped in one or more `ExceptionGroups <ExceptionGroup>` (`#2786 <https://github.com/python-trio/trio/issues/2786>`__)


Features
~~~~~~~~

- Add `trio.testing.wait_all_threads_completed`, which blocks until no threads are running tasks. This is intended to be used in the same way as `trio.testing.wait_all_tasks_blocked`. (`#2937 <https://github.com/python-trio/trio/issues/2937>`__)
- :class:`Path` is now a subclass of :class:`pathlib.PurePath`, allowing it to interoperate with other standard
:mod:`pathlib` types.

Instantiating :class:`Path` now returns a concrete platform-specific subclass, one of :class:`PosixPath` or
:class:`WindowsPath`, matching the behavior of :class:`pathlib.Path`. (`#2959 <https://github.com/python-trio/trio/issues/2959>`__)


Bugfixes
~~~~~~~~

- The pthread functions are now correctly found on systems using vanilla versions of musl libc. (`#2939 <https://github.com/python-trio/trio/issues/2939>`__)


Miscellaneous internal changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- use the regular readme for the PyPI long_description (`#2866 <https://github.com/python-trio/trio/issues/2866>`__)


Trio 0.24.0 (2024-01-10)
------------------------

Expand Down
5 changes: 5 additions & 0 deletions docs/source/reference-io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,11 @@ Asynchronous path objects

.. autoclass:: Path
:members:
:inherited-members:

.. autoclass:: PosixPath

.. autoclass:: WindowsPath


.. _async-file-objects:
Expand Down
4 changes: 4 additions & 0 deletions docs/source/reference-testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ Inter-task ordering

.. autofunction:: wait_all_tasks_blocked

.. autofunction:: wait_all_threads_completed

.. autofunction:: active_thread_count


.. _testing-streams:

Expand Down
10 changes: 0 additions & 10 deletions newsfragments/2786.breaking.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/2939.bugfix.rst

This file was deleted.

1 change: 1 addition & 0 deletions newsfragments/2987.issue.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix crash when importing trio in embedded Python on Windows, and other installs that remove docstrings.
Loading

0 comments on commit 811d289

Please sign in to comment.