Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Releases: jorenham/asynced

1.3.1

24 May 13:03
4b406ad
Compare
Choose a tag to compare

Fixed:

  • Ignored exceptions before State has been set
  • StopAsyncIteration raised in __await__ when cancelled before set

1.3.0

23 May 22:51
8b5bde4
Compare
Choose a tag to compare

Features:

  • StateDict constructor now additionally accepts the signature:
    StateDict(aiterable: AsyncIterable[Mapping[K, V]]) -> StateDict[K, V]
  • StateDict.differences() that returns an async iterator of (key, value_old | None, value_new | None)
  • StateDict.keys_contained() that returns an async iterator of the current and future keys as (key, key in statedict)
  • StateDict.update(), like dict.update()

Fixes:

  • StateCollection async iterable producers that yield items are "batched" if they do not return control to the event loop in between yields. This allows for multiple collection items to be set together, without resulting in separate updates for await or aiter of the instance.

1.2.1

18 May 20:18
41e0803
Compare
Choose a tag to compare

Made the buffer within State.__aiter__ of finite size (max 4 by default), avoiding potential memory leaks

1.2.0

12 May 22:18
e2c317b
Compare
Choose a tag to compare

New

Added three new methods to StateDict[K, V]:

  • .additions() -> AsyncIterator[tuple[K, V]]: Yields (key, value) once a new key is set in state dict (in the future).
  • .deletions() -> AsyncIterator[tuple[K, V]] : Like additions(), but for deleted keys.
  • .changes() -> AsyncIterator[tuple[K, V, V]]: Yields (key, value_old, value_new) once an existing key is set to a new value.

If the async iterable constructor argument of a StateDict[K, V] can now yield (K, ...) (in contrast to (K, V)) to delete the state dict entry with the key (not documented yet).

Removed

  • StateDict.head: The new methods are more flexible and robust

Fixed

  • Async iteration of a State instance now internally uses a lightweight queue of futures, to ensure that all changes are iterated (even if it's iterated over slower than it changes).

1.1.1

11 May 23:15
0f02414
Compare
Choose a tag to compare

StateDict constructor now additionally accepts the following argument:

  • StateDict(aiterable: AsyncIterable[tuple[K, StateVar[V]]]) -> StateDict[K, V]

1.1.0

11 May 08:53
e6e32d5
Compare
Choose a tag to compare
  • StateDict constructor now additionally accepts the following arguments:

    • StateDict(mapping: Mapping[K, StateVar[V]]) -> StateDict[K, V]
    • StateDict(mapping: Mapping[str, StateVar[V]], kwargs: StateVar[V]) -> StateDict[str, V]
    • StateDict(aiterable: AsyncIterable[tuple[K, V]]) -> StateDict[K, V]
  • The latest set/deleted item can be accessed as a state tuple with StateDict.head: StateTuple[K, V | None]

1.0.0

03 May 17:10
144db10
Compare
Choose a tag to compare

First release 🎉