Skip to main content

beef

Beef is good for your health.

An opinionated distributed RPC using AMQP messages (inspired by celery amqp backend).

Installing

pip install pybeef

Usage

Worker:

from beef import beef

@beef
async def add(x: int, y: int) -> int:
    return x + y

Server:

async def server():
    async with add.connect('amqp://localhost/'):
        await add.serve()  # here server blocks forever, executing incoming tasks

if __name__ == '__main__':
    import asyncio

    asyncio.run(server())

Client (blocking):

async def client():
    async with add.connect('amqp://localhost/'):
        task_id = await add.submit(1, 2)  # submits task
        result = await add.result(task_id)  # waits for completion

if __name__ == '__main__':
    import asyncio

    asyncio.run(client())

Client (polling):

import asyncio

async def client():
    async with add.connect('amqp://localhost/'):
        task_id = await add.submit(1, 2)  # submits task

        while True:
            status = await add.get_status(task_id)
            if status.is_final:
                break
            await asyncio.sleep(1)
        print(f'Task {task_id} completed with status {status})

if __name__ == '__main__':
    import asyncio

    asyncio.run(client())

Testing

You need a running RabbitMQ server for testing. For example:

docker run -it --network host rabbitmq

Then, make sure that test dependencies are installed:

pip install .[test]

Finally, run the tests

python -m pytest beef/test

or

make test

Building

pip wheel . --no-deps -w wheels/

or

make

Publishing

twine upload wheels/pybeef-XXX.whl -u __token__ -p <secret-pipy-token>

Metadata

Release files for pybeef 0.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pybeef 0.0.14
File Interpreter ABI Platform Actions
pybeef-0.0.14-py3-none-any.whl Python 3 none any Details for pybeef-0.0.14-py3-none-any.whl

Release files / pybeef-0.0.14-py3-none-any.whl

Download URL pybeef-0.0.14-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e87da697aa4589906418e0018ea3467c0c7edd726c18940137d935020d9b2707
BLAKE2b-256 checksum
How to use checksums
25d38480ce66e96fafb6634528d468e9ae453668f479b34963bf3fe4eba5b393
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.11

Security for pybeef 0.0.14

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page