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.0.tar.gz (3.4 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.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for uservice-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3b4c61718594025639905f9dc1ead4afbae6710393ae6269aa20672e3e1cb359
MD5 aee36e8c9ac86bfac12fcbe2574cd1dc
BLAKE2b-256 3be4d348f511eac84ec7e0dfbe2edf265a56cb48175b034233d3a9c8ea41eb22

See more details on using hashes here.

File details

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

File metadata

  • Download URL: uservice-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 786d7c237fcb49f039291d851106e19f7547dff668612d115d29045600fbd69e
MD5 65dcfc8b7aeebeb3474638dffa995c72
BLAKE2b-256 cfcf489768d2270dd51895ebd4aa6cedcd7aca9389c1fe59e5eff44deca227aa

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