plasmite 1.2.1__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {plasmite-1.2.1 → plasmite-2.0.0}/LICENSE +1 -1
  2. {plasmite-1.2.1 → plasmite-2.0.0}/MANIFEST.in +3 -0
  3. plasmite-2.0.0/PKG-INFO +205 -0
  4. plasmite-2.0.0/README.md +182 -0
  5. plasmite-2.0.0/THIRD_PARTY_NOTICES.md +31 -0
  6. plasmite-2.0.0/native/views.c +1126 -0
  7. plasmite-2.0.0/plasmite/__init__.py +1545 -0
  8. plasmite-2.0.0/plasmite/_include/plasmite.h +545 -0
  9. plasmite-2.0.0/plasmite/_views.py +229 -0
  10. plasmite-2.0.0/plasmite/_views_fallback.py +626 -0
  11. plasmite-2.0.0/plasmite/aio.py +798 -0
  12. plasmite-2.0.0/plasmite/py.typed +0 -0
  13. plasmite-2.0.0/plasmite.egg-info/PKG-INFO +205 -0
  14. {plasmite-1.2.1 → plasmite-2.0.0}/plasmite.egg-info/SOURCES.txt +10 -1
  15. {plasmite-1.2.1 → plasmite-2.0.0}/plasmite.egg-info/entry_points.txt +1 -0
  16. {plasmite-1.2.1 → plasmite-2.0.0}/pyproject.toml +7 -3
  17. plasmite-2.0.0/setup.py +196 -0
  18. plasmite-2.0.0/tests/test_append_views.py +282 -0
  19. plasmite-2.0.0/tests/test_asyncio_api.py +453 -0
  20. plasmite-2.0.0/tests/test_bindings.py +822 -0
  21. plasmite-2.0.0/tests/test_handle_callbacks.py +216 -0
  22. plasmite-2.0.0/tests/test_thread_safety.py +190 -0
  23. plasmite-2.0.0/tests/test_view_streams.py +260 -0
  24. plasmite-2.0.0/tests/test_views.py +265 -0
  25. {plasmite-1.2.1 → plasmite-2.0.0}/tests/test_wheel_platform.py +14 -1
  26. {plasmite-1.2.1 → plasmite-2.0.0}/wheel_platform.py +5 -3
  27. plasmite-1.2.1/PKG-INFO +0 -197
  28. plasmite-1.2.1/README.md +0 -174
  29. plasmite-1.2.1/THIRD_PARTY_NOTICES.md +0 -18
  30. plasmite-1.2.1/plasmite/__init__.py +0 -1450
  31. plasmite-1.2.1/plasmite.egg-info/PKG-INFO +0 -197
  32. plasmite-1.2.1/setup.py +0 -103
  33. plasmite-1.2.1/tests/test_bindings.py +0 -488
  34. plasmite-1.2.1/tests/test_conformance.py +0 -178
  35. plasmite-1.2.1/tests/test_thread_safety.py +0 -197
  36. {plasmite-1.2.1 → plasmite-2.0.0}/plasmite/_cli.py +0 -0
  37. {plasmite-1.2.1 → plasmite-2.0.0}/plasmite.egg-info/dependency_links.txt +0 -0
  38. {plasmite-1.2.1 → plasmite-2.0.0}/plasmite.egg-info/top_level.txt +0 -0
  39. {plasmite-1.2.1 → plasmite-2.0.0}/setup.cfg +0 -0
  40. {plasmite-1.2.1 → plasmite-2.0.0}/tests/test_cli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026
3
+ Copyright (c) 2026 Brandon Harvey
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,3 +1,6 @@
1
1
  include LICENSE
2
2
  include THIRD_PARTY_NOTICES.md
3
3
  include wheel_platform.py
4
+
5
+ include native/views.c
6
+ recursive-include plasmite/_include *.h
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: plasmite
3
+ Version: 2.0.0
4
+ Summary: Persistent JSON message queues for Python - native bindings for local and remote IPC
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/sandover/plasmite
7
+ Project-URL: Repository, https://github.com/sandover/plasmite
8
+ Project-URL: Documentation, https://github.com/sandover/plasmite#readme
9
+ Keywords: ipc,queue,json,messaging,pubsub
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Software Development :: Libraries
17
+ Classifier: Topic :: System :: Networking
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ License-File: THIRD_PARTY_NOTICES.md
22
+ Dynamic: license-file
23
+
24
+ # Plasmite for Python
25
+
26
+ Plasmite stores JSON messages in pools: bounded ring buffers on disk that many processes can write and read at once. `feed` writes a message, `follow` waits for new ones, and `fetch` reads what the pool holds and stops. Each message carries a sequence number (`seq`), a time, tags and a JSON object as `data`. When a pool fills, new messages replace the oldest. Local pools need no server, and the same calls work with pools on a shared HTTPS server and UDP endpoints. The [project README](https://github.com/sandover/plasmite#readme) explains the model and the CLI.
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ uv add plasmite # the library, in a uv project
32
+ uv tool install plasmite # the plasmite CLI on its own
33
+ ```
34
+
35
+ The package needs Python 3.10 or newer. Wheels for macOS, Linux and Windows on x64 and ARM64 bundle the native library and the `plasmite` CLI. Linux needs glibc 2.35 or newer. On Windows ARM64, use native Python 3.11 or newer. [Distribution](https://github.com/sandover/plasmite/blob/main/docs/record/distribution.md) covers other platforms and the C SDK.
36
+
37
+ ## Quick start
38
+
39
+ Record a temperature reading, watch for it, then read recent history.
40
+
41
+ ```python
42
+ from plasmite import Client
43
+
44
+ with Client("./data") as client, client.open("sensors", create=True) as pool:
45
+ with pool.follow(tags=["kitchen"]) as live:
46
+ pool.feed({"temp_c": 21.4}, tags=["kitchen"])
47
+ print(next(live).data) # {'temp_c': 21.4}
48
+ with pool.fetch(last=10) as recent:
49
+ for message in recent:
50
+ print(message.seq, message.tags, message.data)
51
+ ```
52
+
53
+ `follow` fixes its position before it returns, so it sees the feed that comes after it. `fetch` stops at the last message present when it opened. The module functions `open`, `create_pool`, `list_pools` and `delete_pool` use the default directory, `~/.plasmite/pools`. `create=True` makes a 1 MiB pool; use `create_pool(ref, size_bytes)` to choose a size. `pool.info()["bounds"]` reports the oldest and newest retained sequence.
54
+
55
+ The [API examples](https://github.com/sandover/plasmite/blob/main/docs/api-examples.md) compare opening a pool, resuming, and waiting for a tagged reply across languages.
56
+
57
+ ## Read and resume
58
+
59
+ Every read starts at a position. `follow` starts at the next new message by default; `fetch` starts at the oldest retained one.
60
+
61
+ ```python
62
+ from datetime import timedelta
63
+ from plasmite import at
64
+
65
+ pool.fetch(since="oldest") # everything the pool still holds
66
+ pool.fetch(since=42) # sequence 42 onward, inclusive
67
+ pool.fetch(after=42) # resume at 43
68
+ pool.fetch(since="5m") # or since=timedelta(minutes=5)
69
+ pool.fetch(since="2026-11-19T09:00:00Z") # an RFC 3339 time
70
+ pool.fetch(since=at(1_795_078_800_000_000_000)) # the same time as Unix nanoseconds
71
+ pool.fetch(last=20) # the 20 most recent messages
72
+ pool.follow(tags=["error"]) # only messages carrying every listed tag
73
+ ```
74
+
75
+ `follow` takes the same arguments. Choose one of `since`, `after` and `last`.
76
+
77
+ Save the last sequence you handled and pass it as `after` to resume. If the pool overwrote unread messages, opening or advancing the reader raises `RetentionGapError`. `gap.missing` is the first sequence you missed and `gap.next_seq` the oldest one still retained.
78
+
79
+ ```python
80
+ from pathlib import Path
81
+ from plasmite import RetentionGapError
82
+
83
+ checkpoint = Path("sensors.last")
84
+ last = int(checkpoint.read_text()) if checkpoint.exists() else 0
85
+ while True:
86
+ try:
87
+ with pool.follow(after=last) as reader:
88
+ for message in reader:
89
+ print(message.data)
90
+ last = message.seq
91
+ checkpoint.write_text(str(last))
92
+ except RetentionGapError as gap:
93
+ last = gap.next_seq - 1
94
+ print(f"Missed {gap.missing} through {last}. Resuming at {gap.next_seq}.")
95
+ ```
96
+
97
+ Use `next(reader)` or `reader.get()` to wait for one message. `reader.get(timeout=2.0)` waits up to two seconds and returns `None` on timeout, leaving the reader open. `timeout=0` polls. A finished reader raises `StopIteration`.
98
+
99
+ ## Message data and forwarding
100
+
101
+ A local or HTTPS `feed` returns a `Receipt` with the assigned `seq` and `time`. `fetch` and `follow` return `Message` values that own their stored bytes and outlive the pool. Read `seq`, `time`, `tags` and `sender` without decoding `data`. The first access to `data` decodes and caches a Python dict. `message.field("temp_c")` decodes one top-level field, and `message.field("unit", "celsius")` returns a default when the field is absent.
102
+
103
+ ```python
104
+ with pool.fetch(last=1) as reader:
105
+ message = next(reader)
106
+ print(message.seq, message.field("temp_c"))
107
+ archive.feed(message) # forward data and tags
108
+ archive.feed(message.data, tags=["review"]) # write the object with new tags
109
+ archive.feed(b'{"temp_c":21.4}', format="json") # write encoded JSON
110
+ ```
111
+
112
+ Forwarding a `Message` gives it a new sequence and time and keeps its data, tags and declared source. Edits to the cached dict leave the stored bytes intact; feed `message.data` to write the edited object.
113
+
114
+ `message.time` holds exact Unix nanoseconds, and `message.datetime` gives a UTC datetime at Python's microsecond precision. A timezone-aware datetime also works as `since`. `message.meta` holds the tags, the declared source, and the `sender` a server records for writes made with an access key. `str(message)` and `message.json` give the JSON line.
115
+
116
+ ## Batches
117
+
118
+ On local and HTTPS pools, `pool.feed_many(values, tags=...)` takes an iterable of dictionaries. Plasmite validates every entry before publishing, commits them together, and returns receipts in input order.
119
+
120
+ `reader.get_many(max=32, timeout=2)` waits for one message, then returns up to 32 available messages. It returns `None` if the wait expires and `[]` when a fetch reaches its end.
121
+
122
+ ## HTTPS and UDP
123
+
124
+ To use a pool on a shared server, connect once with `plasmite access connect https://pools.example.net:9743`, then open the pool by URL. `list_pools()` still lists the local directory.
125
+
126
+ ```python
127
+ import plasmite
128
+
129
+ with plasmite.open("https://pools.example.net:9743/sensors", create=True) as pool:
130
+ pool.feed({"temp_c": 21.4}, tags=["kitchen"])
131
+ ```
132
+
133
+ UDP trades delivery guarantees for low overhead. A send returns `None` once the operating system accepts the datagram. Reads deliver messages in arrival order, including duplicates and late arrivals. To run this example, create `sensors` with `plasmite pool create sensors` and run `plasmite serve --udp-follow` in another terminal.
134
+
135
+ ```python
136
+ import plasmite
137
+
138
+ with plasmite.open("udp://127.0.0.1:9701/sensors", source="sensor-a") as pool:
139
+ pool.feed({"temp_c": 21.4}, tags=["kitchen"])
140
+ with pool.follow(since="oldest") as reader:
141
+ for message in reader:
142
+ print(message.seq, message.data)
143
+ ```
144
+
145
+ `source=` labels the messages a handle sends. `pool.feed(payload, format="raw")` sends a byte string that the receiver stores as `message.data["bytes"]`. Read with `reader.events()` or `reader.next_event(wait=...)` to see `UdpSkip` for ranges the server skipped and `UdpProgress` for subscription progress. The [UDP spec](https://github.com/sandover/plasmite/blob/main/spec/udp/v2/SPEC.md) defines delivery, and the [shared limits](https://github.com/sandover/plasmite/blob/main/spec/v2/SPEC.md#limits) cover pool sizes, message sizes and transport capacity.
146
+
147
+ ## Pool descriptions
148
+
149
+ Give a pool a short description and an example message so readers know what it carries and what to write.
150
+
151
+ ```python
152
+ import plasmite
153
+
154
+ with plasmite.create_pool("kitchen", about="Kitchen readings", example={"temp_c": 21.4}) as pool:
155
+ print(pool.info()["about"])
156
+ pool.set_description(about="Kitchen and pantry readings")
157
+ ```
158
+
159
+ `info()` and `list_pools()` include the description fields. `set_description()` replaces both fields and clears any you omit.
160
+
161
+ ## Errors and concurrency
162
+
163
+ Native failures raise a subclass of `PlasmiteError` for each of the nine error kinds: `UsageError`, `NotFoundError`, `AlreadyExistsError`, `BusyError`, `PermissionDeniedError`, `CorruptError`, `IoError`, `RetentionGapError` and `InternalError`. Each carries `kind` and, when known, `path`, `seq` and `offset`. `UsageError` is also a `ValueError`, and `NotFoundError` is also a `LookupError`. A value of the wrong Python type raises `TypeError`.
164
+
165
+ Each `Client` and pool serializes its own native calls, and separate handles run concurrently. A second concurrent read on the same reader raises `BusyError`. To stop a reader from another thread, call its `close()`, or pass a `threading.Event` as `cancel` when you open it and set the event.
166
+
167
+ ## Async Python
168
+
169
+ Use `plasmite.aio` in an asyncio application. `aio.open` takes a local reference, HTTPS URL or UDP URL, and the async API uses the same messages and read options as the synchronous API.
170
+
171
+ ```python
172
+ import asyncio
173
+ from plasmite import aio
174
+
175
+
176
+ async def main():
177
+ async with aio.open("handoffs", create=True) as pool:
178
+ async with pool.follow(tags=["handoff"]) as reader:
179
+ await pool.feed({"status": "ready"}, tags=["handoff"])
180
+ print((await anext(reader)).data)
181
+ async with pool.fetch(last=10, tags=["handoff"]) as reader:
182
+ async for message in reader:
183
+ print(message.data)
184
+
185
+
186
+ asyncio.run(main())
187
+ ```
188
+
189
+ Enter the reader's async context, or await `pool.follow()` or `pool.fetch()`, to fix the read position before your next operation. Use `await anext(reader)`, `async for`, or `await reader.get(timeout=2.0)` for a bounded wait. Cancelling a wait leaves the reader open and keeps any message it already pulled for your next call. Exit the context or call `await reader.aclose()` to close the reader. `feed_many` and `get_many` work the same way with `await`. A cancelled feed may already have written its message.
190
+
191
+ [Python feed and read benchmarks](https://github.com/sandover/plasmite/blob/main/docs/performance/plain-loops.md) compare the synchronous and asyncio APIs.
192
+
193
+ ## Building from source
194
+
195
+ From the repo root, build and stage the native library and run the binding tests:
196
+
197
+ ```bash
198
+ just bindings-python-test
199
+ ```
200
+
201
+ A source install without a bundled library uses the operating system's library search path. The [build guide](https://github.com/sandover/plasmite/blob/main/docs/building.md) covers building wheels against a specific SDK.
202
+
203
+ ## License
204
+
205
+ MIT
@@ -0,0 +1,182 @@
1
+ # Plasmite for Python
2
+
3
+ Plasmite stores JSON messages in pools: bounded ring buffers on disk that many processes can write and read at once. `feed` writes a message, `follow` waits for new ones, and `fetch` reads what the pool holds and stops. Each message carries a sequence number (`seq`), a time, tags and a JSON object as `data`. When a pool fills, new messages replace the oldest. Local pools need no server, and the same calls work with pools on a shared HTTPS server and UDP endpoints. The [project README](https://github.com/sandover/plasmite#readme) explains the model and the CLI.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ uv add plasmite # the library, in a uv project
9
+ uv tool install plasmite # the plasmite CLI on its own
10
+ ```
11
+
12
+ The package needs Python 3.10 or newer. Wheels for macOS, Linux and Windows on x64 and ARM64 bundle the native library and the `plasmite` CLI. Linux needs glibc 2.35 or newer. On Windows ARM64, use native Python 3.11 or newer. [Distribution](https://github.com/sandover/plasmite/blob/main/docs/record/distribution.md) covers other platforms and the C SDK.
13
+
14
+ ## Quick start
15
+
16
+ Record a temperature reading, watch for it, then read recent history.
17
+
18
+ ```python
19
+ from plasmite import Client
20
+
21
+ with Client("./data") as client, client.open("sensors", create=True) as pool:
22
+ with pool.follow(tags=["kitchen"]) as live:
23
+ pool.feed({"temp_c": 21.4}, tags=["kitchen"])
24
+ print(next(live).data) # {'temp_c': 21.4}
25
+ with pool.fetch(last=10) as recent:
26
+ for message in recent:
27
+ print(message.seq, message.tags, message.data)
28
+ ```
29
+
30
+ `follow` fixes its position before it returns, so it sees the feed that comes after it. `fetch` stops at the last message present when it opened. The module functions `open`, `create_pool`, `list_pools` and `delete_pool` use the default directory, `~/.plasmite/pools`. `create=True` makes a 1 MiB pool; use `create_pool(ref, size_bytes)` to choose a size. `pool.info()["bounds"]` reports the oldest and newest retained sequence.
31
+
32
+ The [API examples](https://github.com/sandover/plasmite/blob/main/docs/api-examples.md) compare opening a pool, resuming, and waiting for a tagged reply across languages.
33
+
34
+ ## Read and resume
35
+
36
+ Every read starts at a position. `follow` starts at the next new message by default; `fetch` starts at the oldest retained one.
37
+
38
+ ```python
39
+ from datetime import timedelta
40
+ from plasmite import at
41
+
42
+ pool.fetch(since="oldest") # everything the pool still holds
43
+ pool.fetch(since=42) # sequence 42 onward, inclusive
44
+ pool.fetch(after=42) # resume at 43
45
+ pool.fetch(since="5m") # or since=timedelta(minutes=5)
46
+ pool.fetch(since="2026-11-19T09:00:00Z") # an RFC 3339 time
47
+ pool.fetch(since=at(1_795_078_800_000_000_000)) # the same time as Unix nanoseconds
48
+ pool.fetch(last=20) # the 20 most recent messages
49
+ pool.follow(tags=["error"]) # only messages carrying every listed tag
50
+ ```
51
+
52
+ `follow` takes the same arguments. Choose one of `since`, `after` and `last`.
53
+
54
+ Save the last sequence you handled and pass it as `after` to resume. If the pool overwrote unread messages, opening or advancing the reader raises `RetentionGapError`. `gap.missing` is the first sequence you missed and `gap.next_seq` the oldest one still retained.
55
+
56
+ ```python
57
+ from pathlib import Path
58
+ from plasmite import RetentionGapError
59
+
60
+ checkpoint = Path("sensors.last")
61
+ last = int(checkpoint.read_text()) if checkpoint.exists() else 0
62
+ while True:
63
+ try:
64
+ with pool.follow(after=last) as reader:
65
+ for message in reader:
66
+ print(message.data)
67
+ last = message.seq
68
+ checkpoint.write_text(str(last))
69
+ except RetentionGapError as gap:
70
+ last = gap.next_seq - 1
71
+ print(f"Missed {gap.missing} through {last}. Resuming at {gap.next_seq}.")
72
+ ```
73
+
74
+ Use `next(reader)` or `reader.get()` to wait for one message. `reader.get(timeout=2.0)` waits up to two seconds and returns `None` on timeout, leaving the reader open. `timeout=0` polls. A finished reader raises `StopIteration`.
75
+
76
+ ## Message data and forwarding
77
+
78
+ A local or HTTPS `feed` returns a `Receipt` with the assigned `seq` and `time`. `fetch` and `follow` return `Message` values that own their stored bytes and outlive the pool. Read `seq`, `time`, `tags` and `sender` without decoding `data`. The first access to `data` decodes and caches a Python dict. `message.field("temp_c")` decodes one top-level field, and `message.field("unit", "celsius")` returns a default when the field is absent.
79
+
80
+ ```python
81
+ with pool.fetch(last=1) as reader:
82
+ message = next(reader)
83
+ print(message.seq, message.field("temp_c"))
84
+ archive.feed(message) # forward data and tags
85
+ archive.feed(message.data, tags=["review"]) # write the object with new tags
86
+ archive.feed(b'{"temp_c":21.4}', format="json") # write encoded JSON
87
+ ```
88
+
89
+ Forwarding a `Message` gives it a new sequence and time and keeps its data, tags and declared source. Edits to the cached dict leave the stored bytes intact; feed `message.data` to write the edited object.
90
+
91
+ `message.time` holds exact Unix nanoseconds, and `message.datetime` gives a UTC datetime at Python's microsecond precision. A timezone-aware datetime also works as `since`. `message.meta` holds the tags, the declared source, and the `sender` a server records for writes made with an access key. `str(message)` and `message.json` give the JSON line.
92
+
93
+ ## Batches
94
+
95
+ On local and HTTPS pools, `pool.feed_many(values, tags=...)` takes an iterable of dictionaries. Plasmite validates every entry before publishing, commits them together, and returns receipts in input order.
96
+
97
+ `reader.get_many(max=32, timeout=2)` waits for one message, then returns up to 32 available messages. It returns `None` if the wait expires and `[]` when a fetch reaches its end.
98
+
99
+ ## HTTPS and UDP
100
+
101
+ To use a pool on a shared server, connect once with `plasmite access connect https://pools.example.net:9743`, then open the pool by URL. `list_pools()` still lists the local directory.
102
+
103
+ ```python
104
+ import plasmite
105
+
106
+ with plasmite.open("https://pools.example.net:9743/sensors", create=True) as pool:
107
+ pool.feed({"temp_c": 21.4}, tags=["kitchen"])
108
+ ```
109
+
110
+ UDP trades delivery guarantees for low overhead. A send returns `None` once the operating system accepts the datagram. Reads deliver messages in arrival order, including duplicates and late arrivals. To run this example, create `sensors` with `plasmite pool create sensors` and run `plasmite serve --udp-follow` in another terminal.
111
+
112
+ ```python
113
+ import plasmite
114
+
115
+ with plasmite.open("udp://127.0.0.1:9701/sensors", source="sensor-a") as pool:
116
+ pool.feed({"temp_c": 21.4}, tags=["kitchen"])
117
+ with pool.follow(since="oldest") as reader:
118
+ for message in reader:
119
+ print(message.seq, message.data)
120
+ ```
121
+
122
+ `source=` labels the messages a handle sends. `pool.feed(payload, format="raw")` sends a byte string that the receiver stores as `message.data["bytes"]`. Read with `reader.events()` or `reader.next_event(wait=...)` to see `UdpSkip` for ranges the server skipped and `UdpProgress` for subscription progress. The [UDP spec](https://github.com/sandover/plasmite/blob/main/spec/udp/v2/SPEC.md) defines delivery, and the [shared limits](https://github.com/sandover/plasmite/blob/main/spec/v2/SPEC.md#limits) cover pool sizes, message sizes and transport capacity.
123
+
124
+ ## Pool descriptions
125
+
126
+ Give a pool a short description and an example message so readers know what it carries and what to write.
127
+
128
+ ```python
129
+ import plasmite
130
+
131
+ with plasmite.create_pool("kitchen", about="Kitchen readings", example={"temp_c": 21.4}) as pool:
132
+ print(pool.info()["about"])
133
+ pool.set_description(about="Kitchen and pantry readings")
134
+ ```
135
+
136
+ `info()` and `list_pools()` include the description fields. `set_description()` replaces both fields and clears any you omit.
137
+
138
+ ## Errors and concurrency
139
+
140
+ Native failures raise a subclass of `PlasmiteError` for each of the nine error kinds: `UsageError`, `NotFoundError`, `AlreadyExistsError`, `BusyError`, `PermissionDeniedError`, `CorruptError`, `IoError`, `RetentionGapError` and `InternalError`. Each carries `kind` and, when known, `path`, `seq` and `offset`. `UsageError` is also a `ValueError`, and `NotFoundError` is also a `LookupError`. A value of the wrong Python type raises `TypeError`.
141
+
142
+ Each `Client` and pool serializes its own native calls, and separate handles run concurrently. A second concurrent read on the same reader raises `BusyError`. To stop a reader from another thread, call its `close()`, or pass a `threading.Event` as `cancel` when you open it and set the event.
143
+
144
+ ## Async Python
145
+
146
+ Use `plasmite.aio` in an asyncio application. `aio.open` takes a local reference, HTTPS URL or UDP URL, and the async API uses the same messages and read options as the synchronous API.
147
+
148
+ ```python
149
+ import asyncio
150
+ from plasmite import aio
151
+
152
+
153
+ async def main():
154
+ async with aio.open("handoffs", create=True) as pool:
155
+ async with pool.follow(tags=["handoff"]) as reader:
156
+ await pool.feed({"status": "ready"}, tags=["handoff"])
157
+ print((await anext(reader)).data)
158
+ async with pool.fetch(last=10, tags=["handoff"]) as reader:
159
+ async for message in reader:
160
+ print(message.data)
161
+
162
+
163
+ asyncio.run(main())
164
+ ```
165
+
166
+ Enter the reader's async context, or await `pool.follow()` or `pool.fetch()`, to fix the read position before your next operation. Use `await anext(reader)`, `async for`, or `await reader.get(timeout=2.0)` for a bounded wait. Cancelling a wait leaves the reader open and keeps any message it already pulled for your next call. Exit the context or call `await reader.aclose()` to close the reader. `feed_many` and `get_many` work the same way with `await`. A cancelled feed may already have written its message.
167
+
168
+ [Python feed and read benchmarks](https://github.com/sandover/plasmite/blob/main/docs/performance/plain-loops.md) compare the synchronous and asyncio APIs.
169
+
170
+ ## Building from source
171
+
172
+ From the repo root, build and stage the native library and run the binding tests:
173
+
174
+ ```bash
175
+ just bindings-python-test
176
+ ```
177
+
178
+ A source install without a bundled library uses the operating system's library search path. The [build guide](https://github.com/sandover/plasmite/blob/main/docs/building.md) covers building wheels against a specific SDK.
179
+
180
+ ## License
181
+
182
+ MIT
@@ -0,0 +1,31 @@
1
+ # Third-party notices
2
+
3
+ This project vendors the following third-party components:
4
+
5
+ ## yyjson 0.12.0
6
+
7
+ Plasmite builds the parser source in `vendor/yyjson/`.
8
+
9
+ ```text
10
+ MIT License
11
+
12
+ Copyright (c) 2020 YaoYuan <ibireme@gmail.com>
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ ```