Repid
Repid framework: simple to use, fast to run and extensible to adopt job scheduler.
Example
Here is how the easiest example of producer-consumer application can look like.
Producer:
import asyncio
from repid import Connection, Job, RabbitMessageBroker, Repid
app = Repid(Connection(RabbitMessageBroker("amqp://user:password@localhost:5672")))
async def main() -> None:
async with app.magic():
await Job(name="awesome_job").enqueue()
asyncio.run(main())
Consumer:
import asyncio
from repid import Connection, RabbitMessageBroker, Repid, Router, Worker
app = Repid(Connection(RabbitMessageBroker("amqp://user:password@localhost:5672")))
router = Router()
@router.actor
async def awesome_job() -> None:
print("Hello async jobs!")
await asyncio.sleep(1.0)
async def main() -> None:
async with app.magic():
await Worker(routers=[router]).run()
asyncio.run(main())
Install
Repid supports Python versions 3.8 and up and is installable via pip
.
There are also a couple of additional dependencies you may want to install, depending on your use case, e.g.
Why repid?
Asyncio
Repid
is built around asyncio
. It means it's pretty fast.
And you don't have to worry that it will slow down your other asyncio-driven code.
Ease of integration
There is an abstraction layer on top of other queue solutions.
It means that even if repid
doesn't provide some broker out of the box,
you will be able to write your own.
Built with microservices in mind
Your producer and consumer can be running in different containers, repid
will handle it just fine.
Can be used with other languages
Repid
uses json (de-)serialization by default, which makes integration with other languages
as easy as possible. You're also able to easily override default (de-)serialization
behavior thanks to PEP 544 Protocols.
Integrated scheduling
Repid
has its own scheduling mechanisms.
You can delay job execution until some date or even execute it every once in a while.
No need for extra dependencies!
Inspiration
Repid
is inspired by dramatiq
and arq
.
License
Repid is distributed under the terms of the MIT license. Please see License.md for more information.
Repid's logo is distributed under the terms of the CC BY-NC 4.0 license. It is originally created by ari_the_crow_.