Skip to main content

Crossbill

PyPI version

Description

Crossbill is a Python library focused on building Finagle-style Service-based asynchronous clients and servers. It is very much a work in progress, and as such, does not follow semantic versioning, nor should the APIs be considered stable.

Getting Started

Crossbill is published to PyPI. Here's a walkthrough of how to include it as a dependency in your project via uv.

Create a New Project

$ uv init crossbill-demo
$ cd crossbill-demo

Add Crossbill as a Dependency

$ uv add crossbill

Code the Example

By default, uv will generate a hello.py file. Replace its contents with the following code:

import asyncio
from crossbill.core import Service
from crossbill.string import (
    StringClient,
    StringRequest,
    StringResponse,
    StringServer,
)
from crossbill.transport import Address


class EchoService(Service[StringRequest, StringResponse]):
    async def __call__(self, request: StringRequest) -> StringResponse:
        return StringResponse(request.value)


async def main() -> None:
    address = Address("localhost", 12345)
    server = StringServer()
    await server.serve(address, EchoService())

    message = "Hello from crossbill-demo!"
    client = StringClient()
    await client.connect(address)
    response = await client(StringRequest(message))
    print(response.value)

    await client.close()
    await server.close()


if __name__ == "__main__":
    asyncio.run(main())

Run the Example

$ uv run hello.py
Hello from crossbill-demo!

Development

The crossbill project uses uv, "[a]n extremely fast Python package and project manager, written in Rust." If you don't have it installed, follow the installation guide in order to do so.

Dependency Installation

With uv installed, run the following from the command line to ensure that all dependencies are properly installed.

$ uv sync

Typing

This project uses type hints extensively, and uses both pyright and mypy to see issues related to them.

To see the existing issues, run the following from the command line.

$ uv run pyright .
$ uv run mypy .

Testing

This project uses pytest along with asyncio in order to run asynchronous tests. A predominant number of tests within this library will fit that criteria due to the nature of the domain space.

To run the existing unit tests, run the following from the command line.

$ uv run pytest

Coverage

This project uses coverage and pytest-cov for measuring code coverage. To generate the report when running tests, run the following from the command line.

$ uv run pytest --cov

Metadata

Release files for crossbill 0.1.7

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

Source distribution (sdist)

Source distribution for crossbill 0.1.7
File Size Uploaded
crossbill-0.1.7.tar.gz 25.7 kB Details

Built distribution (wheel)

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

Total release size: 55.9 kB

Release files / crossbill-0.1.7.tar.gz

Download URL crossbill-0.1.7.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
06a9a94a63817f58fd9899fd71ee64d3b8645cdf15962006595c3c3e5c882993
BLAKE2b-256 checksum
How to use checksums
e3fd088070a8dca83d9a2397d319e00b885e394acdcf26a4d6b70969847aa281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Release files / crossbill-0.1.7-py3-none-any.whl

Download URL crossbill-0.1.7-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55bf237a5db3b905b79dce063a79d6eae9b63fdab9556701e4ce59716b4e1cc3
BLAKE2b-256 checksum
How to use checksums
db8d8545f58fae9393137477587629ea0bfc99594233fd277253cc89ab4db4d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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