onestep 0.5.0__py3-none-any.whl
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.
- onestep/__init__.py +67 -0
- onestep/_utils.py +21 -0
- onestep/broker/__init__.py +22 -0
- onestep/broker/base.py +144 -0
- onestep/broker/cron.py +51 -0
- onestep/broker/memory.py +75 -0
- onestep/broker/mysql.py +63 -0
- onestep/broker/rabbitmq.py +153 -0
- onestep/broker/redis/__init__.py +9 -0
- onestep/broker/redis/pubsub.py +93 -0
- onestep/broker/redis/stream.py +114 -0
- onestep/broker/sqs/__init__.py +4 -0
- onestep/broker/sqs/sns.py +53 -0
- onestep/broker/sqs/sqs.py +181 -0
- onestep/broker/webhook.py +84 -0
- onestep/cli.py +80 -0
- onestep/cron.py +211 -0
- onestep/exception.py +35 -0
- onestep/message.py +169 -0
- onestep/middleware/__init__.py +7 -0
- onestep/middleware/base.py +32 -0
- onestep/middleware/config.py +77 -0
- onestep/middleware/unique.py +48 -0
- onestep/onestep.py +281 -0
- onestep/retry.py +117 -0
- onestep/signal.py +11 -0
- onestep/state.py +23 -0
- onestep/worker.py +205 -0
- onestep-0.5.0.dist-info/METADATA +116 -0
- onestep-0.5.0.dist-info/RECORD +32 -0
- onestep-0.5.0.dist-info/WHEEL +4 -0
- onestep-0.5.0.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: onestep
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: 仅需一步,轻松实现分布式异步任务。
|
|
5
|
+
Author-email: miclon <jcnd@163.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: async,distributed,queue,task
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Requires-Dist: asgiref>=3.6.0
|
|
19
|
+
Requires-Dist: blinker>=1.5
|
|
20
|
+
Requires-Dist: croniter>=1.3.8
|
|
21
|
+
Requires-Dist: use-rabbitmq>=0.2.1
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: autopep8>=2.0.2; extra == 'dev'
|
|
24
|
+
Requires-Dist: loguru>=0.6.0; extra == 'dev'
|
|
25
|
+
Requires-Dist: nacos-sdk-python>=0.1.12; extra == 'dev'
|
|
26
|
+
Requires-Dist: redis>=4.5.1; extra == 'dev'
|
|
27
|
+
Requires-Dist: use-redis>=0.1.92; extra == 'dev'
|
|
28
|
+
Provides-Extra: mysql
|
|
29
|
+
Requires-Dist: use-mysql>=0.0.4; extra == 'mysql'
|
|
30
|
+
Provides-Extra: redis
|
|
31
|
+
Requires-Dist: use-redis>=0.1.6; extra == 'redis'
|
|
32
|
+
Provides-Extra: sqs
|
|
33
|
+
Requires-Dist: use-sqs>=0.1.0; extra == 'sqs'
|
|
34
|
+
Provides-Extra: test
|
|
35
|
+
Requires-Dist: httpx>=0.23.3; extra == 'test'
|
|
36
|
+
Requires-Dist: pytest>=7.2.2; extra == 'test'
|
|
37
|
+
Requires-Dist: redis>=4.5.1; extra == 'test'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
<div align=center><img src="https://onestep.code05.com/logo-3.svg" width="300"></div>
|
|
41
|
+
<div align=center>
|
|
42
|
+
<a href="https://github.com/mic1on/onestep/actions/workflows/test.yml?query=event%3Apush+branch%3Amain" target="_blank">
|
|
43
|
+
<img src="https://github.com/mic1on/onestep/workflows/test%20suite/badge.svg?branch=main&event=push" alt="Test">
|
|
44
|
+
</a>
|
|
45
|
+
<a href="https://pypi.org/project/onestep" target="_blank">
|
|
46
|
+
<img src="https://img.shields.io/pypi/v/onestep.svg" alt="Package version">
|
|
47
|
+
</a>
|
|
48
|
+
|
|
49
|
+
<a href="https://pypi.org/project/onestep" target="_blank">
|
|
50
|
+
<img src="https://img.shields.io/pypi/pyversions/onestep.svg" alt="Supported Python versions">
|
|
51
|
+
</a>
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<hr />
|
|
55
|
+
仅需一步,轻松实现分布式异步任务。
|
|
56
|
+
|
|
57
|
+
## Brokers
|
|
58
|
+
|
|
59
|
+
- [x] MemoryBroker
|
|
60
|
+
- [x] CronBroker
|
|
61
|
+
- [x] WebHookBroker
|
|
62
|
+
- [x] RabbitMQBroker
|
|
63
|
+
- [x] RedisBroker
|
|
64
|
+
- [x] RedisStreamBroker
|
|
65
|
+
- [x] RedisPubSubBroker
|
|
66
|
+
- [x] SQSBroker
|
|
67
|
+
- [x] MysqlBroker
|
|
68
|
+
|
|
69
|
+
## 😋example
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
# example.py
|
|
73
|
+
|
|
74
|
+
from onestep import step, WebHookBroker
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# 对外提供一个webhook接口,接收外部的消息
|
|
78
|
+
@step(from_broker=WebHookBroker(path="/push"))
|
|
79
|
+
def waiting_messages(message):
|
|
80
|
+
print("收到消息:", message)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if __name__ == '__main__':
|
|
84
|
+
step.start(block=True)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
also, you can use `onestep` command to start, like this:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
$ onestep example
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
then, you can send a message to webhook:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
$ curl -X POST -H "Content-Type: application/json" -d '{"a": 1}' http://localhost:8090/push
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 🤩 other brokers
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from onestep import step, CronBroker
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
# 每3秒触发一次任务
|
|
106
|
+
@step(from_broker=CronBroker("* * * * * */3", body={"a": 1}))
|
|
107
|
+
def cron_task(message):
|
|
108
|
+
assert message.body == {"a": 1}
|
|
109
|
+
return message
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
if __name__ == '__main__':
|
|
113
|
+
step.start(block=True)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
🤔more examples: [examples](example)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
onestep/__init__.py,sha256=G5jiZELHx7-rmPYdvz9sI3r6glUsChDlq6bwLRR-d7c,1576
|
|
2
|
+
onestep/_utils.py,sha256=ySYmy-o2o3BurvLfuLWKGXR8TLwug6aTDNMvA3_QjKM,414
|
|
3
|
+
onestep/cli.py,sha256=vXrMAg7Nl0Ra79DraBrCtQq8xJC443AUEqFXe7rVNYo,2133
|
|
4
|
+
onestep/cron.py,sha256=9SqA_eeOx4lfmssOhqg6YEJsKpZ7r8qxF5HMmapb9uk,8138
|
|
5
|
+
onestep/exception.py,sha256=T-tqfRrJZT9Y85qe-1l-1PcHZzV2jxv-61HAhOc4AKE,753
|
|
6
|
+
onestep/message.py,sha256=OZlFtMEqGDw7KTlowrM527otI-So4lPKGIcO-SuF3JY,5480
|
|
7
|
+
onestep/onestep.py,sha256=1vqCGksGfSbpjeGTnfvQV7UXe029zxLxKSyOnrwnQ0I,9663
|
|
8
|
+
onestep/retry.py,sha256=fPO139hQrcMjXZuQ4QfFaQR57VEqv_EKS2WSz92Ayvc,3706
|
|
9
|
+
onestep/signal.py,sha256=tz9bGzTFZeBviG_iaGLfy4OyFKlWat6szEI6kWEGfTA,337
|
|
10
|
+
onestep/state.py,sha256=UVG91CXCabU64X6qgcO0S7RzbBP8ut0ID7aTMww94us,618
|
|
11
|
+
onestep/worker.py,sha256=5rPr1J-bZnfPqkvjli3YOWncdfl5IujxJb--M75Ryu8,7252
|
|
12
|
+
onestep/broker/__init__.py,sha256=nf-gZJTzG1FhtVkiE4_QtTwhDhsQnGhQ4wdDdeNJsOE,635
|
|
13
|
+
onestep/broker/base.py,sha256=ahhbBH_TgrfNN7GWf8PUs0fuCyoSzsBuR3P7pWwjER8,4962
|
|
14
|
+
onestep/broker/cron.py,sha256=p85pgtRpV12Md-HW56j6NSX42gGcBH9AHnbajPkZpM0,1608
|
|
15
|
+
onestep/broker/memory.py,sha256=GdmYFbFwemlShrUVHJrI-hbMVkgSKRmj_rl8VmnQdp8,2173
|
|
16
|
+
onestep/broker/mysql.py,sha256=IS0Mu4JJ2-__4M4jJxPNjUUTUi0jZ1hQomfEOQgwV_E,1716
|
|
17
|
+
onestep/broker/rabbitmq.py,sha256=JdOQ_vGlqTIETIUkJTMrqaT4prE5v2O5xDDSXgEwgCk,5545
|
|
18
|
+
onestep/broker/webhook.py,sha256=x8h6zGsgjGFQdzr-UVXW8vGGUM_XCllglSCBqXh4rtw,2501
|
|
19
|
+
onestep/broker/redis/__init__.py,sha256=lqjvBKpMGf6I34nyJTEAq7XU2a8aQemhMGCbb5aByFI,236
|
|
20
|
+
onestep/broker/redis/pubsub.py,sha256=m0QzBT--rftfTXSc6D3wTzfQrwUgv5mEEDnnER7nB9A,2708
|
|
21
|
+
onestep/broker/redis/stream.py,sha256=A134jbMZckrlElkWZAfSpKxI8XmJsT_u_Y4U_lVuvsE,3800
|
|
22
|
+
onestep/broker/sqs/__init__.py,sha256=0qaj2UXheaWJNVDO8G3ohtrhZuWhieEkoHe5i0asGQQ,120
|
|
23
|
+
onestep/broker/sqs/sns.py,sha256=ipS3dlUe8w4XwnSEHWO7GUc8F85WQq5HlVKCD-KyMig,1553
|
|
24
|
+
onestep/broker/sqs/sqs.py,sha256=PmXT91HLOHii2M_OTKPh9YNUsAAMU4JOJhre_7SqD5I,6180
|
|
25
|
+
onestep/middleware/__init__.py,sha256=MP_45lqr4pecmbzQBnn2-AODQ0N_Fss8nl2SA7Zzljo,347
|
|
26
|
+
onestep/middleware/base.py,sha256=adWQ_Lx2Nkaw4ySojIaa3lwUIUu97pHR_l5YMr0lrbw,975
|
|
27
|
+
onestep/middleware/config.py,sha256=1DhaRDG83IDOth0tjm0iuxXcysE3AISNJFv4ks5NiBs,2435
|
|
28
|
+
onestep/middleware/unique.py,sha256=L4F4NnpDO6hReHa21tUiiPH5GRMeRNgGgC0o6zgu5v0,1355
|
|
29
|
+
onestep-0.5.0.dist-info/METADATA,sha256=AQXiLJGRMpvea3umh6TOMEvejfB54lKjhNRGLVS68go,3275
|
|
30
|
+
onestep-0.5.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
31
|
+
onestep-0.5.0.dist-info/entry_points.txt,sha256=b0n103vacvfk-cbFbSPanfV89Y4qBTjOtS7PwxjaXzI,45
|
|
32
|
+
onestep-0.5.0.dist-info/RECORD,,
|