This release is a pre-release and may not be stable for production use.
ui-stream
把后台任务的进度发给 UI,定期保存快照,让最终结果由业务自己的事务提交。 核心同步、无第三方依赖;通过三个端口接入业务事件、实时通道和持久存储。
快速上手
Python ≥3.11,在虚拟环境中从源码运行:
python -m pip install --no-deps .
python -m examples.counter
python -m demos.sqlite --database ./demo.sqlite3 --port 8765
打开 http://127.0.0.1:8765。Demo 仅用标准库 HTTP/SQLite 和合成数据;macOS/Linux 可运行。
Counter 和 Demo 位于仓库的 examples/、demos/,需在仓库根目录运行;默认 wheel 只含核心。
发布到 PyPI 后可安装 ui-stream==0.1.0a1;import 名为 ui_stream。
适用边界
| 适合 | 由宿主负责 / 不保证 |
|---|---|
| 任务进度、最新快照、尽力实时尾流 | 权限、跨进程 fencing、任务重试与业务结果事务 |
| 有界缓冲、checkpoint、提交后再发终态 | 完整历史重放、断线无损、exactly-once |
| 同步 Python 宿主,自定义事件与存储 | 自动续跑、读者断开即取消、生产级 Demo 服务 |
扩展入口
实现 EventCodec、LivePublisher、ArchiveStore 即可接入,无须继承或修改 StreamRuntime。
内存 Counter 展示自定义事件与结果;SQLite Demo 展示持久快照、SSE 与故障恢复。
from ui_stream import StreamPolicy
from examples.counter import make_counter
runtime, channel, store = make_counter(policy=StreamPolicy(checkpoint_event_count=1))
runtime.send(4)
runtime.send(9)
runtime.finish(status="DONE", completion=13)
assert store.snapshot.latest == 9 and store.snapshot.result == 13
| 安装范围 | 依赖 |
|---|---|
| 核心 wheel | 标准库 |
| 仓库 Counter / SQLite Demo | 标准库 + 已安装核心 |
[json] |
Pydantic ≥2.10,<3 |
[redis] |
Pydantic ≥2.10,<3,redis-py ≥3.5.3 |
架构与完成顺序 · API 契约 · Demo · 性能图表 · 方案选型 · 贡献 · 安全 · 发布
CI 的源码矩阵覆盖 Python 3.11–3.14 / Linux、macOS;wheel、sdist 与 README 验证在 Linux 执行。
维护者:raja <rajawwang@foxmail.com>(GitHub 0RAJA)。
MIT 及来源说明;原版权声明保持不变。
Metadata
Release files for ui-stream 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ui_stream-0.1.0a1.tar.gz | 17.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ui_stream-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.3 kB
Release files / ui_stream-0.1.0a1.tar.gz
| Download URL | ui_stream-0.1.0a1.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c132fd70733b2450118e22a32af2809785d45495a3d1fc8de823b8310c21348
|
|
BLAKE2b-256 checksum How to use checksums |
0d63ee411a7f8933b6baf8baf5ae2bc9f8eabfa7449c55769bda56fc38a64a53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / ui_stream-0.1.0a1-py3-none-any.whl
| Download URL | ui_stream-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
325f35149c068de53a8e880fcf6be1ee42b1eace8ef3fbbc0c11dc5a45ae797c
|
|
BLAKE2b-256 checksum How to use checksums |
b1f65fad62b493c9c320869e3e75c32243e784ea0ec735c49e73bdb3ba7f9ea7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logSecurity for ui-stream 0.1.0a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ui_stream-0.1.0a1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.