Skip to content

Commit 04e92f6

Browse files
authored
Merge pull request #1164 from njsmith/release-0.12.0
Bump version to 0.12.0
2 parents fb0997e + 96eee0d commit 04e92f6

28 files changed

+122
-94
lines changed

docs/source/history.rst

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,127 @@ Release history
55

66
.. towncrier release notes start
77
8+
Trio 0.12.0 (2019-07-31)
9+
------------------------
10+
11+
Features
12+
~~~~~~~~
13+
14+
- If you have a `~trio.abc.ReceiveStream` object, you can now use
15+
``async for data in stream: ...`` instead of calling
16+
`~trio.abc.ReceiveStream.receive_some`. Each iteration gives an
17+
arbitrary sized chunk of bytes. And the best part is, the loop
18+
automatically exits when you reach EOF, so you don't have to check for
19+
it yourself anymore. Relatedly, you no longer need to pick a magic
20+
buffer size value before calling
21+
`~trio.abc.ReceiveStream.receive_some`; you can ``await
22+
stream.receive_some()`` with no arguments, and the stream will
23+
automatically pick a reasonable size for you. (`#959 <https://github.com/python-trio/trio/issues/959>`__)
24+
- We cleaned up the distinction between the "abstract channel interface"
25+
and the "memory channel" concrete implementation.
26+
`trio.abc.SendChannel` and `trio.abc.ReceiveChannel` have been slimmed
27+
down, `trio.MemorySendChannel` and `trio.MemoryReceiveChannel` are now
28+
public types that can be used in type hints, and there's a new
29+
`trio.abc.Channel` interface for future bidirectional channels. (`#719 <https://github.com/python-trio/trio/issues/719>`__)
30+
- Add :func:`trio.run_process` as a high-level helper for running a process
31+
and waiting for it to finish, like the standard :func:`subprocess.run` does. (`#822 <https://github.com/python-trio/trio/issues/822>`__)
32+
- On Linux, when wrapping a bare file descriptor in a Trio socket object,
33+
Trio now auto-detects the correct ``family``, ``type``, and ``protocol``.
34+
This is useful, for example, when implementing `systemd socket activation
35+
<http://0pointer.de/blog/projects/socket-activation.html>`__. (`#251 <https://github.com/python-trio/trio/issues/251>`__)
36+
- Trio sockets have a new method `~trio.socket.SocketType.is_readable` that allows
37+
you to check whether a socket is readable. This is useful for HTTP/1.1 clients. (`#760 <https://github.com/python-trio/trio/issues/760>`__)
38+
- We no longer use runtime code generation to dispatch core functions
39+
like `current_time`. Static analysis tools like mypy and pylint should
40+
now be able to recognize and analyze all of Trio's top-level functions
41+
(though some class attributes are still dynamic... we're working on it). (`#805 <https://github.com/python-trio/trio/issues/805>`__)
42+
- Add `trio.hazmat.FdStream` for wrapping a Unix file descriptor as a `~trio.abc.Stream`. (`#829 <https://github.com/python-trio/trio/issues/829>`__)
43+
- Trio now gives a reasonable traceback and error message in most cases
44+
when its invariants surrounding cancel scope nesting have been
45+
violated. (One common source of such violations is an async generator
46+
that yields within a cancel scope.) The previous behavior was an
47+
inscrutable chain of TrioInternalErrors. (`#882 <https://github.com/python-trio/trio/issues/882>`__)
48+
- MultiError now defines its ``exceptions`` attribute in ``__init__()``
49+
to better support linters and code autocompletion. (`#1066 <https://github.com/python-trio/trio/issues/1066>`__)
50+
- Use ``__slots__`` in more places internally, which should make Trio slightly faster. (`#984 <https://github.com/python-trio/trio/issues/984>`__)
51+
52+
53+
Bugfixes
54+
~~~~~~~~
55+
56+
- Destructor methods (``__del__``) are now protected against ``KeyboardInterrupt``. (`#676 <https://github.com/python-trio/trio/issues/676>`__)
57+
- The :class:`trio.Path` methods :meth:`~trio.Path.glob` and
58+
:meth:`~trio.Path.rglob` now return iterables of :class:`trio.Path`
59+
(not :class:`pathlib.Path`). (`#917 <https://github.com/python-trio/trio/issues/917>`__)
60+
- Inspecting the :attr:`~trio.CancelScope.cancel_called` attribute of a
61+
not-yet-exited cancel scope whose deadline is in the past now always
62+
returns ``True``, like you might expect. (Previously it would return
63+
``False`` for not-yet-entered cancel scopes, and for active cancel
64+
scopes until the first checkpoint after their deadline expiry.) (`#958 <https://github.com/python-trio/trio/issues/958>`__)
65+
- The :class:`trio.Path` classmethods, :meth:`~trio.Path.home` and
66+
:meth:`~trio.Path.cwd`, are now async functions. Previously, a bug
67+
in the forwarding logic meant :meth:`~trio.Path.cwd` was synchronous
68+
and :meth:`~trio.Path.home` didn't work at all. (`#960 <https://github.com/python-trio/trio/issues/960>`__)
69+
- An exception encapsulated within a :class:`MultiError` doesn't need to be
70+
hashable anymore.
71+
72+
.. note::
73+
74+
This is only supported if you are running python >= 3.6.4. You can
75+
refer to `this github PR <https://github.com/python/cpython/pull/4014>`_
76+
for details. (`#1005 <https://github.com/python-trio/trio/issues/1005>`__)
77+
78+
79+
Improved Documentation
80+
~~~~~~~~~~~~~~~~~~~~~~
81+
82+
- To help any user reading through Trio's function implementations, start using public names (not _core) whenever possible. (`#1017 <https://github.com/python-trio/trio/issues/1017>`__)
83+
84+
85+
Deprecations and Removals
86+
~~~~~~~~~~~~~~~~~~~~~~~~~
87+
88+
- The ``clear`` method on `trio.Event` has been deprecated. (`#637 <https://github.com/python-trio/trio/issues/637>`__)
89+
- ``run_sync_in_worker_thread`` has become `trio.to_thread.run_sync`, in
90+
order to make it shorter, and more consistent with the new
91+
``trio.from_thread``. And ``current_default_worker_thread_limiter`` is
92+
now `trio.to_thread.current_default_thread_limiter`. (Of course the
93+
old names still work with a deprecation warning, for now.) (`#810 <https://github.com/python-trio/trio/issues/810>`__)
94+
- Give up on trying to have different low-level waiting APIs on Unix and
95+
Windows. All platforms now have `trio.hazmat.wait_readable`,
96+
`trio.hazmat.wait_writable`, and `trio.hazmat.notify_closing`. The old
97+
platform-specific synonyms ``wait_socket_*``,
98+
``notify_socket_closing``, and ``notify_fd_closing`` have been
99+
deprecated. (`#878 <https://github.com/python-trio/trio/issues/878>`__)
100+
- It turns out that it's better to treat subprocess spawning as an async
101+
operation. Therefore, direct construction of `Process` objects has
102+
been deprecated. Use `trio.open_process` instead. (`#1109 <https://github.com/python-trio/trio/issues/1109>`__)
103+
104+
105+
Miscellaneous internal changes
106+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107+
108+
- The plumbing of Trio's cancellation system has been substantially overhauled
109+
to improve performance and ease future planned improvements. Notably, there is
110+
no longer any internal concept of a "cancel stack", and checkpoints now take
111+
constant time regardless of the cancel scope nesting depth. (`#58 <https://github.com/python-trio/trio/issues/58>`__)
112+
- We've slightly relaxed our definition of which Trio operations act as
113+
:ref:`checkpoints <checkpoint-rule>`. A Trio async function that exits by
114+
throwing an exception is no longer guaranteed to execute a checkpoint;
115+
it might or might not. The rules are unchanged for async functions that
116+
don't exit with an exception, async iterators, and async context managers.
117+
:func:`trio.testing.assert_checkpoints` has been updated to reflect the
118+
new behavior: if its ``with`` block exits with an exception, no assertion
119+
is made. (`#474 <https://github.com/python-trio/trio/issues/474>`__)
120+
- Calling ``str`` on a :exc:`trio.Cancelled` exception object returns "Cancelled" instead of an empty string. (`#674 <https://github.com/python-trio/trio/issues/674>`__)
121+
- Change the default timeout in :func:`trio.open_tcp_stream` to 0.250 seconds, for consistency with RFC 8305. (`#762 <https://github.com/python-trio/trio/issues/762>`__)
122+
- On win32 we no longer set SO_EXCLUSIVEADDRUSE when binding a socket in :exc:`trio.open_tcp_listeners`. (`#928 <https://github.com/python-trio/trio/issues/928>`__)
123+
- Any attempt to inherit from `CancelScope` or `Nursery` now raises
124+
`TypeError`. (Trio has never been able to safely support subclassing
125+
here; this change just makes it more obvious.)
126+
Also exposed as public classes for type-checking, etc. (`#1021 <https://github.com/python-trio/trio/issues/1021>`__)
127+
128+
8129
Trio 0.11.0 (2019-02-09)
9130
------------------------
10131

newsfragments/1005.bugfix.rst

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

newsfragments/1017.doc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/1021.misc.rst

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

newsfragments/1066.feature.rst

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

newsfragments/1109.removal.rst

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

newsfragments/251.feature.rst

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

newsfragments/474.misc.rst

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

newsfragments/58.misc.rst

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

newsfragments/637.removal.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/674.misc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/676.bugfix.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/719.feature.rst

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

newsfragments/760.feature.rst

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

newsfragments/762.misc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/805.feature.rst

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

newsfragments/810.removal.rst

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

newsfragments/822.feature.rst

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

newsfragments/829.feature.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/878.removal.rst

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

newsfragments/882.feature.rst

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

newsfragments/917.bugfix.rst

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

newsfragments/928.misc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/958.bugfix.rst

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

newsfragments/959.feature.rst

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

newsfragments/960.bugfix.rst

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

newsfragments/984.feature.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

trio/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# This file is imported from __init__.py and exec'd from setup.py
22

3-
__version__ = "0.11.0+dev"
3+
__version__ = "0.12.0+dev"

0 commit comments

Comments
 (0)