permchain
Project description
permchain
Get started
pip install permchain
Usage
from permchain import InMemoryPubSubConnection, PubSub, Topic
topic_one = Topic("one")
chain_one = Topic.IN.subscribe() | (lambda x: x + 'b') | topic_one.publish()
chain_two = topic_one.subscribe() | (lambda x: x + 'c') | Topic.OUT.publish()
conn = InMemoryPubSubConnection()
pubsub = PubSub(processes=(chain_one, chain_two), connection=conn)
assert pubsub.invoke('a') == ['abc']
Check tests
and examples
for more examples.
Roadmap
- Add initial retry support (pending changes in
langchain
) - Detect cycles (aka. infinite loops) and throw an error
- Allow user to catch that error (by subcribing to an error topic?)
- Replace Queue data structure with a Log data structure (this will enable checking the status of the readers, etc.)
- eg. https://anyio.readthedocs.io/en/3.x/streams.html
- Implement IN and OUT topics as regular topics
- Enable resuming PubSub from the "middle" of the computation
- Add Redis-backed Connection implementation
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
permchain-0.0.2.tar.gz
(6.2 kB
view details)
Built Distribution
File details
Details for the file permchain-0.0.2.tar.gz
.
File metadata
- Download URL: permchain-0.0.2.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d2d0a48fe084440b8658bd91a56739dcce0b290a108c67125b80a7dce2b94e3 |
|
MD5 | 68cc8cecd4ba12180b859b9f979ed02f |
|
BLAKE2b-256 | 1e414158a67e1ecbe4fcb5e31c9404ab998173a2649801ecca915a8ce0eeac1d |
File details
Details for the file permchain-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: permchain-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f91c039769b7beecff1f1b4ed5b639087e92c24b29fd59d8340f1d8ae102aac6 |
|
MD5 | 44131d1d7edcb4a3f612b1c1430b9f53 |
|
BLAKE2b-256 | 60948511471f59629eb7862e877dd0013706b9f612333a95a47503d455deecb1 |