Metadata-Version: 2.4
Name: onestep
Version: 0.5.3
Summary: 仅需一步，轻松实现分布式异步任务。
Author-email: miclon <jcnd@163.com>
License: MIT
Keywords: async,distributed,queue,task
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Requires-Dist: asgiref>=3.6.0
Requires-Dist: blinker>=1.5
Requires-Dist: croniter>=1.3.8
Requires-Dist: use-rabbitmq>=0.2.1
Provides-Extra: dev
Requires-Dist: autopep8>=2.0.2; extra == 'dev'
Requires-Dist: loguru>=0.6.0; extra == 'dev'
Requires-Dist: nacos-sdk-python>=0.1.12; extra == 'dev'
Requires-Dist: redis>=4.5.1; extra == 'dev'
Requires-Dist: use-redis>=0.1.92; extra == 'dev'
Provides-Extra: mysql
Requires-Dist: use-mysql>=0.0.4; extra == 'mysql'
Provides-Extra: redis
Requires-Dist: use-redis>=0.1.6; extra == 'redis'
Provides-Extra: sqs
Requires-Dist: use-sqs>=0.1.0; extra == 'sqs'
Provides-Extra: test
Requires-Dist: httpx>=0.23.3; extra == 'test'
Requires-Dist: pytest>=7.2.2; extra == 'test'
Requires-Dist: redis>=4.5.1; extra == 'test'
Description-Content-Type: text/markdown

<div align=center><img src="https://onestep.code05.com/logo-3.svg" width="300"></div>
<div align=center>
<a href="https://github.com/mic1on/onestep/actions/workflows/test.yml?query=event%3Apush+branch%3Amain" target="_blank">
    <img src="https://github.com/mic1on/onestep/workflows/test%20suite/badge.svg?branch=main&event=push" alt="Test">
</a>
<a href="https://pypi.org/project/onestep" target="_blank">
    <img src="https://img.shields.io/pypi/v/onestep.svg" alt="Package version">
</a>

<a href="https://pypi.org/project/onestep" target="_blank">
    <img src="https://img.shields.io/pypi/pyversions/onestep.svg" alt="Supported Python versions">
</a>

</div>
<hr />
仅需一步，轻松实现分布式异步任务。

## Brokers

- [x] MemoryBroker
- [x] CronBroker
- [x] WebHookBroker
- [x] RabbitMQBroker
- [x] RedisBroker
    - [x] RedisStreamBroker
    - [x] RedisPubSubBroker 
- [x] SQSBroker
- [x] MysqlBroker

## 😋example

```python
# example.py

from onestep import step, WebHookBroker


# 对外提供一个webhook接口，接收外部的消息
@step(from_broker=WebHookBroker(path="/push"))
def waiting_messages(message):
    print("收到消息：", message)


if __name__ == '__main__':
    step.start(block=True)
```

also, you can use `onestep` command to start, like this:

```bash
$ onestep example
```

then, you can send a message to webhook:

```bash
$ curl -X POST -H "Content-Type: application/json" -d '{"a": 1}' http://localhost:8090/push
```

## 🤩 other brokers

```python
from onestep import step, CronBroker


# 每3秒触发一次任务
@step(from_broker=CronBroker("* * * * * */3", body={"a": 1}))
def cron_task(message):
    assert message.body == {"a": 1}
    return message


if __name__ == '__main__':
    step.start(block=True)
```

🤔more examples: [examples](example)
