Trio-util

Latest version: v0.7.0

Safety actively analyzes 618481 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

0.7.0

Added
- `iter_move_on_after()` and `iter_fail_after()` are iterator wrappers
that apply a timeout to a single iteration.
- `run_and_cancelling()` is a context manager that runs a background
task and cancels it on exit of the block.
- `AsyncValue.eventual_values()` supports a `held_for` option.
Fixed
- `move_on_when()` now returns a cancel scope other than the implementation's
nursery, so that cancelled_caught is meaningful.

0.6.0

Added
- `AsyncValue` and `compose_values()` now have type hints and generic typing.
- `move_on_when()` is a cancel scope that exits when a given async callable
returns.
Changed
- `_transform_` parameter of `compose_values()` is now keyword-only.
Fixed
- slight performance improvement to `AsyncValue.value` setter when there is a
predicate match.

0.5.0

⚠ includes breaking changes!
Added
- `eventual_values()` is a new iterator of `AsyncValue` which assures
"eventual consistency" (i.e. the caller always receives the latest value).
- `open_transform()` is a new context manager of `AsyncValue` enabling derived
values.
Changed
- `compose_values()` context manager was changed from async to synchronous.
- `compose_values()` now takes an optional transform function.
- `RepeatedEvent` replaces both `UnqueuedRepeatedEvent` and `MailboxRepeatedEvent`.
The new class handles both unqueued and eventual consistency cases, while
supporting multiple listeners. It also offers a one-shot `wait_event()` method
for cases where an iterator isn't needed.

0.4.1

Fixed
- `compose_values()` had a race where the composed value may be incorrect if
the underlying values are mutated while entering the async context manager.

0.4.0

Added
- `transitions()` is a new method of `AsyncValue` that allows subscription
to value transitions via an iterator.
Changed
- `UnqueuedRepeatedEvent` supports broadcasting to multiple listeners
- `TaskStats` now reports all scheduling rates over a given threshold, rather
than the maximum observed rate.
Fixed
- `multi_error_defer_to()` would use the wrong context when raising `RuntimeError`

0.3.0

Added
- `trio_async_generator` is a decorator which adapts a generator containing
Trio constructs for safe use. (Normally, it's not allowed to yield from a
nursery or cancel scope when implementing async generators.)
Changed
- `TaskStats` now reports all slow task step events over a given threshold,
rather than the maximum observed task step.
Removed
- `AsyncDictionary` has been removed. It didn't work well for the advertised
use case of multiplexing a network connection, and trying to address that
while keeping the regular dict interface (itself of unproven value) seemed to
result in an overly complex API. See [discussion](https://github.com/groove-x/trio-util/issues/4).

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.