Playground
Info
This is a playground where you can edit and run code in your browser using PyScript - give it a try, it's awesome!
async def main() -> None:
    import repid
    app = repid.Repid(repid.Connection(repid.InMemoryMessageBroker()))
    router = repid.Router()
    @router.actor
    async def string_length(the_string: str) -> int:
        print(the_string)
        await asyncio.sleep(1)
        print("I've slept well...")
        return len(the_string)
    async with app.magic():
        hello_job = repid.Job(
            "string_length",
            args=dict(the_string="Hello world!"),
        )
        await hello_job.queue.declare()
        await hello_job.enqueue()
        worker = repid.Worker(routers=[router], messages_limit=1, handle_signals=[])
        await worker.run()
", "\n")  # user inputted new lines == "
"
        f.feed(input_html)
        f.text = f.text[10:]  # remove "Edit me!"
        locals = {}
        exec(f.text, globals(), locals)
        asyncio.create_task(locals.get("main")())
Your output will be here: