|
| 1 | +--- |
| 2 | +title: Trio Monthly - 2021/07 |
| 3 | +date: 2021-08-01T00:00:00Z |
| 4 | +draft: false |
| 5 | +tags: |
| 6 | + - trio-weekly |
| 7 | + - trio |
| 8 | +--- |
| 9 | + |
| 10 | +Welcome to the July 2021 edition of Trio Monthly. This is a monthly blog post dedicated to |
| 11 | +highlighting what's going on in the Trio world, from developments in the core library to |
| 12 | +developments in new and existing libraries and application powered by Trio. |
| 13 | + |
| 14 | +If you wish to get your library featured in a Trio Monthly post, please contact the author on Matrix |
| 15 | +(``@lura:veriny.tf``). |
| 16 | + |
| 17 | +## Trio Library |
| 18 | + |
| 19 | +### Cyclic Garbage Fixes |
| 20 | + |
| 21 | +Trio had another source of cyclic garbage eliminated this month, in |
| 22 | +[PR #2063](https://github.com/python-trio/trio/pull/2063). |
| 23 | + |
| 24 | +> Trio now avoids creating cyclic garbage when a `MultiError` is generated and filtered, |
| 25 | +> including invisibly within the cancellation system. This means errors raised |
| 26 | +> through nurseries and cancel scopes should result in less GC latency. |
| 27 | +
|
| 28 | +Trio has to do low-level things when it comes to frames, tracebacks, and exceptions, which sometimes |
| 29 | +results in cyclic references being left around. These aren't picked up by the regular Python |
| 30 | +reference count garbage collector, but by the cyclic detector instead, causing potential GC pressure |
| 31 | +and application slowdowns. Eliminating these cycles allows the objects to be freed much sooner, |
| 32 | +improving the speed and memory usage of all Trio applications. |
| 33 | + |
| 34 | +## External Libraries |
| 35 | + |
| 36 | +We have two libraries to feature this month. |
| 37 | + |
| 38 | +### trio-parallel |
| 39 | + |
| 40 | +The first of this is the ``trio-parallel`` library. As the author puts it: |
| 41 | + |
| 42 | +> ``trio-parallel`` is a simple CPU-parallelism library for Trio. This month, an advanced subprocess |
| 43 | +> worker customization API, the ``cache_scope`` context manager, was merged, allowing choice of |
| 44 | +> initialization, timeout, and retirement policies, as well as defining a scoped lifetime for an |
| 45 | +> isolated, local worker cache. This feature has been pre-released in version 1.0.0a0 available on |
| 46 | +> PyPI for wider testing for a final 1.0 release later this year. Please see |
| 47 | +> https://trio-parallel.rtfd.io/en/1.0.0a0/ for details. |
| 48 | +
|
| 49 | +### Tractor |
| 50 | + |
| 51 | +The second library featured is the Tractor library. As the author puts it: |
| 52 | + |
| 53 | +> For those who haven't heard of us, ``tractor`` is a multi-processing-runtime library which applies |
| 54 | +> structured concurrency from the ground up on process managment and IPC. We had our first alpha |
| 55 | +> release this past Feb. and now our second this Aug. 1st 🥳. |
| 56 | +
|
| 57 | +> The quick and dirty summary for this release is: |
| 58 | +> - Updated our unidirectional streaming APIs to be more `async_generator.aclosing()`-like |
| 59 | +> - Vastly improved our actor reaping during cancellation and error propagation for the |
| 60 | +> `multiprocessing` spawner backend |
| 61 | +> - Added a next-gen, fully bi-directional streaming API with complete, transitive SC semantics |
| 62 | +> for IPC 🏄🏼♀️ |
| 63 | +> - Hardened our multi-process debugger support (ala `pdb++`) to prevent root process clobbers of |
| 64 | +> children who have acquired the repl tty lock; this is thanks to our new ``tractor.Context`` |
| 65 | +> cross-actor-task syncing protocol. |
| 66 | +> - Started some tinkering with `msgspec` for an optional alternative to `msgpack-python`. |
| 67 | +> - Improved our infected-`asyncio`-in-guest-mode cross-loop streaming semantics by simplifying to |
| 68 | +> memory channel only style data passing between frameworks. |
| 69 | +> - Added a ton of new examples to both the readme and repository script set. |
| 70 | +> - Removed both `tractor.run()` and support for invoking sync functions; instead we recommend users |
| 71 | +> try `trio-parallel`! |
| 72 | +> |
| 73 | +> For more details see our [new release](https://github.com/goodboy/tractor/blob/master/NEWS.rst). |
| 74 | +
|
0 commit comments