Skip to main content

pre-commit Code style: black Imports: isort Checked with mypy security: bandit Upload Python Package Coverage Status Documentation Status PyPI version

Introduction

This library is a port of Mediatr in Python.

For more information and usage instructions, see the documentation.

Usage

pip install mediatpy

import asyncio

from mediatpy import Request, RequestHandler, Mediator


class MyResponse:
    pass


class MyRequest(Request[MyResponse]):
    pass


mediator = Mediator()


@mediator.request_handler
class MyRequestHandler(RequestHandler[MyRequest, MyResponse]):
    async def handle(self, request: MyRequest) -> MyResponse:
        return MyResponse()


async def main():
    request = MyRequest()
    response = await mediator.send(request)
    assert isinstance(response, MyResponse)


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

Metadata

Release files for mediatpy 0.2.1

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

Source distribution (sdist)

Source distribution for mediatpy 0.2.1
File Size Uploaded
mediatpy-0.2.1.tar.gz 4.7 kB Details

Built distribution (wheel)

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

Total release size: 9.0 kB

Release files / mediatpy-0.2.1.tar.gz

Download URL mediatpy-0.2.1.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f926643849abcac54b07dc8f33c95a4d41fcd705aec80d6d11c70325ddf9d4c7
BLAKE2b-256 checksum
How to use checksums
e27fc0b1c19ac3f53b5f897e5f8176679ec12ba0ba518531bf1e0cf98068ac42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.0 CPython/3.10.8 Linux/5.15.0-1024-azure

Release files / mediatpy-0.2.1-py3-none-any.whl

Download URL mediatpy-0.2.1-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e88a8d04d77f49dc2839963b9cadad8868837fdad1bb547639cb54fffac41bc
BLAKE2b-256 checksum
How to use checksums
069e679605a76a0fcf769b37ef1774f620cce0b650d50bea907097ba2e6e11ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.0 CPython/3.10.8 Linux/5.15.0-1024-azure

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

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