Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.7
rev: v0.9.9
hooks:
- id: ruff
types: [file]
Expand All @@ -38,15 +38,15 @@ repos:
# tomli needed on 3.10. tomllib is available in stdlib on 3.11+
- tomli
- repo: https://github.com/crate-ci/typos
rev: v1.29.9
rev: typos-dict-v0.12.6
hooks:
- id: typos
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.0
hooks:
- id: sphinx-lint
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.3.1
rev: v1.4.1
hooks:
- id: zizmor
- repo: local
Expand All @@ -59,7 +59,7 @@ repos:
additional_dependencies: ["astor", "attrs", "black", "ruff"]
files: ^src\/trio\/_core\/(_run|(_i(o_(common|epoll|kqueue|windows)|nstrumentation)))\.py$
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.6.2
rev: 0.6.3
hooks:
# Compile requirements
- id: pip-compile
Expand Down
3 changes: 1 addition & 2 deletions docs-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ exceptiongroup >= 1.0.0rc9
immutables >= 0.6

# types used in annotations
# TODO: fix support for importing typing-extensions
pyOpenSSL < 25.0.0
pyOpenSSL
14 changes: 10 additions & 4 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ attrs==25.1.0
# outcome
babel==2.17.0
# via sphinx
beautifulsoup4==4.12.3
beautifulsoup4==4.13.3
# via sphinx-codeautolink
certifi==2025.1.31
# via requests
Expand Down Expand Up @@ -55,10 +55,12 @@ pycparser==2.22 ; os_name == 'nt' or platform_python_implementation != 'PyPy'
# via cffi
pygments==2.19.1
# via sphinx
pyopenssl==24.3.0
pyopenssl==25.0.0
# via -r docs-requirements.in
requests==2.32.3
# via sphinx
roman-numerals-py==3.1.0
# via sphinx
sniffio==1.3.1
# via -r docs-requirements.in
snowballstemmer==2.2.0
Expand All @@ -67,15 +69,15 @@ sortedcontainers==2.4.0
# via -r docs-requirements.in
soupsieve==2.6
# via beautifulsoup4
sphinx==8.1.3
sphinx==8.2.1
# via
# -r docs-requirements.in
# sphinx-codeautolink
# sphinx-hoverxref
# sphinx-rtd-theme
# sphinxcontrib-jquery
# sphinxcontrib-trio
sphinx-codeautolink==0.16.2
sphinx-codeautolink==0.17.1
# via -r docs-requirements.in
sphinx-hoverxref==1.4.2
# via -r docs-requirements.in
Expand All @@ -102,5 +104,9 @@ sphinxcontrib-trio==1.1.2
# via -r docs-requirements.in
towncrier==24.8.0
# via -r docs-requirements.in
typing-extensions==4.12.2
# via
# beautifulsoup4
# pyopenssl
urllib3==2.3.0
# via requests
12 changes: 7 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
from pathlib import Path
from typing import TYPE_CHECKING, cast

from sphinx.util.inventory import _InventoryItem

if TYPE_CHECKING:
from sphinx.application import Sphinx
from sphinx.util.typing import Inventory
Expand Down Expand Up @@ -266,11 +268,11 @@ def add_mapping(
assert isinstance(inventory, dict)
inventory = cast("Inventory", inventory)

inventory[f"py:{reftype}"][f"{target}"] = (
"Python",
version,
f"https://docs.python.org/{url_version}/library/{library}.html/{obj}",
"-",
inventory[f"py:{reftype}"][f"{target}"] = _InventoryItem(
project_name="Python",
project_version=version,
uri=f"https://docs.python.org/{url_version}/library/{library}.html/{obj}",
display_name="-",
)

# This has been removed in Py3.12, so add a link to the 3.11 version with deprecation warnings.
Expand Down
10 changes: 5 additions & 5 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ format all our code to a standard style. While you're editing code you
can be as sloppy as you like about whitespace; and then before you commit,
just run:

.. code-block::
.. code-block:: text

pip install -U pre-commit
pre-commit
Comment on lines 321 to 324
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd personally do .. code-block:: sh or similar when code is intended for use at a shell prompt, but we don't really need syntax highlighting or anything so I don't think it matters

Expand All @@ -332,14 +332,14 @@ nicely formatted. (black doesn't reformat comments or docstrings.)
If you would like, you can even have pre-commit run before you commit by
running:

.. code-block::
.. code-block:: text

pre-commit install

and now pre-commit will run before git commits. You can uninstall the
pre-commit hook at any time by running:

.. code-block::
.. code-block:: text

pre-commit uninstall

Expand All @@ -349,7 +349,7 @@ you can can add ``# fmt: off`` and ``# fmt: on`` comments.

If you want to see what changes black will make, you can use:

.. code-block::
.. code-block:: text

black --diff trio

Expand Down Expand Up @@ -433,7 +433,7 @@ file to install all of the required packages (possibly using a
virtualenv). After that, build the docs using ``make html`` in the
docs directory. The whole process might look something like this:

.. code-block::
.. code-block:: text

cd path/to/project/checkout/
pip install -r docs-requirements.txt
Expand Down
9 changes: 9 additions & 0 deletions src/trio/testing/_memory_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,15 @@ def put_eof(self) -> None:
self._incoming.close()


# TODO: investigate why this is necessary for the docs
MemorySendStream.__module__ = MemorySendStream.__module__.replace(
"._memory_streams", ""
)
MemoryReceiveStream.__module__ = MemoryReceiveStream.__module__.replace(
"._memory_streams", ""
)


def memory_stream_pump(
memory_send_stream: MemorySendStream,
memory_receive_stream: MemoryReceiveStream,
Expand Down
8 changes: 4 additions & 4 deletions src/trio/testing/_raises_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class Matcher(AbstractMatcher[MatchE]):

Examples::

with RaisesGroups(Matcher(ValueError, match="string"))
with RaisesGroups(Matcher(ValueError, match="string")):
...
with RaisesGroups(Matcher(check=lambda x: x.args == (3, "hello"))):
...
Expand Down Expand Up @@ -326,7 +326,7 @@ def matches(

Examples::

assert Matcher(ValueError).matches(my_exception):
assert Matcher(ValueError).matches(my_exception)
# is equivalent to
assert isinstance(my_exception, ValueError)

Expand All @@ -336,7 +336,7 @@ def matches(
assert Matcher(SyntaxError, match="foo").matches(excinfo.value.__cause__)
# above line is equivalent to
assert isinstance(excinfo.value.__cause__, SyntaxError)
assert re.search("foo", str(excinfo.value.__cause__)
assert re.search("foo", str(excinfo.value.__cause__))

"""
if not self._check_type(exception):
Expand Down Expand Up @@ -549,7 +549,7 @@ def __init__(
)
self.allow_unwrapped = allow_unwrapped
self.flatten_subgroups: bool = flatten_subgroups
self.is_baseexceptiongroup = False
self.is_baseexceptiongroup: bool = False

if allow_unwrapped and other_exceptions:
raise ValueError(
Expand Down
18 changes: 11 additions & 7 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ exceptiongroup==1.2.2 ; python_full_version < '3.11'
# pytest
filelock==3.17.0
# via virtualenv
identify==2.6.7
identify==2.6.8
# via pre-commit
idna==3.10
# via
Expand All @@ -71,7 +71,7 @@ importlib-metadata==8.6.1 ; python_full_version < '3.10'
# via sphinx
iniconfig==2.0.0
# via pytest
isort==6.0.0
isort==6.0.1
# via pylint
jedi==0.19.2 ; implementation_name == 'cpython'
# via -r test-requirements.in
Expand Down Expand Up @@ -122,15 +122,17 @@ pylint==3.3.4
# via -r test-requirements.in
pyopenssl==25.0.0
# via -r test-requirements.in
pyright==1.1.393
pyright==1.1.395
# via -r test-requirements.in
pytest==8.3.4
# via -r test-requirements.in
pyyaml==6.0.2
# via pre-commit
requests==2.32.3
# via sphinx
ruff==0.9.7
roman-numerals-py==3.1.0 ; python_full_version >= '3.11'
# via sphinx
ruff==0.9.9
# via -r test-requirements.in
sniffio==1.3.1
# via -r test-requirements.in
Expand All @@ -140,7 +142,9 @@ sortedcontainers==2.4.0
# via -r test-requirements.in
sphinx==7.4.7 ; python_full_version < '3.10'
# via -r test-requirements.in
sphinx==8.1.3 ; python_full_version >= '3.10'
sphinx==8.1.3 ; python_full_version == '3.10.*'
# via -r test-requirements.in
sphinx==8.2.1 ; python_full_version >= '3.11'
# via -r test-requirements.in
sphinxcontrib-applehelp==2.0.0
# via sphinx
Expand Down Expand Up @@ -173,7 +177,7 @@ types-docutils==0.21.0.20241128
# via -r test-requirements.in
types-pyopenssl==24.1.0.20240722
# via -r test-requirements.in
types-setuptools==75.8.0.20250210
types-setuptools==75.8.0.20250225
# via types-cffi
typing-extensions==4.12.2
# via
Expand All @@ -186,7 +190,7 @@ typing-extensions==4.12.2
# pyright
urllib3==2.3.0
# via requests
uv==0.6.2
uv==0.6.3
# via -r test-requirements.in
virtualenv==20.29.2
# via pre-commit
Expand Down
Loading