NySync
Any Data, Any Source, Any Destination.
NySync 是一个 AI-First 的数据同步与任务编排平台:用声明式任务把“任何数据源”持续、可靠地同步到“任何目的地”,并让 Agent 能够安全地生成、校验与运维这些任务。
当前进展(Milestone)
- 已完成:分布式令牌桶限流(Python SDK,基于 Redis)
- 实现包含:LuaTokenBucket(默认)、NumericTokenBucket(GCRA)、StringTokenBucket(Slot-based)
- 支持 Dashboard 可视化与并发/批量场景验证
- 主线目标:平台层的作业管理、调度编排、执行引擎与观测体系
快速开始(Python SDK):
import redis
from ny_sync import TokenBucket, RateUnit
r = redis.Redis(host="localhost", port=6379, db=0, decode_responses=True)
bucket = TokenBucket(r)
key = "demo"
capacity = 10
rate = 60 / RateUnit.MINUTE # 每分钟 60 个
allowed = bucket.allow(key, capacity, rate)
提供分布式令牌桶限流,基于 Redis 实现。内置三种实现:
- LuaTokenBucket(默认):并发能力强,适合通用场景
- NumericTokenBucket(GCRA):高吞吐批量场景
- StringTokenBucket(Slot-based):一个 Token 一个 String Key,便于峰值与历史可视化
安装
pip install ny_sync
快速开始
import redis
from ny_sync import TokenBucket, RateUnit, RateLimit, RateLimitExceeded
r = redis.Redis(host="localhost", port=6379, db=0, decode_responses=True)
# 手动使用(TokenBucket 是 RedisTokenBucket 的简化别名)
bucket = TokenBucket(r)
key = "demo"
capacity = 10 # 桶容量10个
rate = 60 / RateUnit.MINUTE # 每分钟补充 60 个
allowed = bucket.allow(key, capacity, rate)
# 装饰器使用(RateLimit 是 RateLimitDecorator 的简化别名)
@RateLimit(r, "api", capacity, rate)
def my_api():
return "ok"
可视化 Dashboard
运行简单的 Streamlit Dashboard:
# Windows
c:\project\ny_sync\python_sdk\run_dashboard.bat
主要导出
- TokenBucket / RedisTokenBucket / LuaTokenBucket / NumericTokenBucket / StringTokenBucket
- RateUnit(SECOND / MINUTE / HOUR / DAY / WEEK)
- RateLimit / RateLimitExceeded
许可证
MIT
Metadata
Release files for ny-sync 0.1.1
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 | |
|---|---|---|---|---|
| ny_sync-0.1.1.tar.gz | 19.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ny_sync-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.2 kB
Release files / ny_sync-0.1.1.tar.gz
| Download URL | ny_sync-0.1.1.tar.gz |
|---|---|
| Size | 19.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5239799d2c328bfcc6e7a1dec71bd43a9522f38ab4a00228349c88c4b2f64506
|
|
BLAKE2b-256 checksum How to use checksums |
919142f605b2a442e7d7edf3e9b0160f894ef73ecd74c882302ad50fb5d2639d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Release files / ny_sync-0.1.1-py3-none-any.whl
| Download URL | ny_sync-0.1.1-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7419d1dc4386d8fc8f494cdd995205aac20e1a4195209c00494d25a80c5bbf51
|
|
BLAKE2b-256 checksum How to use checksums |
27ba82c264d1d3431cd463265e9c9946bebb2fe39e210bafa73274fd09ee5d03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Security for ny-sync 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.