Skip to main content

A async microservice framework for python

Project description

μService

A async microservice framework for Python. Inspired by FastAPI and Nameko. It uses the uvloop event loop instead of the default python asyncio loop.

Requirements

Python 3.10+

Example

from uservice import Service, EventPublisher, Depends
from typing import Annotated
from pydantic import BaseModel


class Payload(BaseModel):
    foo: int
    bar: str


publisher = EventPublisher()

service_a = Service(name="service_a")


@service_a.rpc()
def dispatch(
        input: Payload,
        publish: Annotated[Callable, Depends(publisher)],
):
    publish("event", payload)


service_b = Service(name="service_b")


@service_b.event_handler("service_a", "event")
def handle(
        payload: Payload,
):
    print(payload)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uservice-0.1.1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uservice-0.1.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file uservice-0.1.1.tar.gz.

File metadata

  • Download URL: uservice-0.1.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for uservice-0.1.1.tar.gz
Algorithm Hash digest
SHA256 155e3a7aa50232b7130b3353967132edd0116c1559bd00cafd47cf7f76befc85
MD5 60d70a07637c89f853fb95e3dbcc5440
BLAKE2b-256 19609187c7d9edefa11d75ca1a4cf876d423637cd9d13eee1310fda1531c37c3

See more details on using hashes here.

File details

Details for the file uservice-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: uservice-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for uservice-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e5e33c29fc7aa7089cb3c5653d7a8a4fc8b0181fe3dd5333b8bf35113d12e88
MD5 c936b8f9cf8f357ac71062255d0cfa9d
BLAKE2b-256 92da2a0edfc91f5e09a7bb4e3f85a30cecfc28b1213d4c28a79e2f889b387c17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page