Skip to main content

Lightweight, efficient and developer-friendly framework for component communication

Project description

drawing

FastCC

Framework for component communication with MQTT and Protocol Buffers :boom:.

  • Lightweight :zap:
  • Efficient :rocket:
  • Developer-friendly :technologist:

This framework is built on top of empicano's aiomqtt.

Example

import asyncio
import contextlib
import logging
import os
import sys
import typing

import aiomqtt
import fastcc

router = fastcc.CCRouter()


@router.route("example")
async def example(name: str, *, database: dict[str, typing.Any]) -> str:
    database[name] = 1
    print(database)
    return f"Hello, {name}!"


async def main() -> None:
    logging.basicConfig(level=logging.INFO)

    database = {}
    mqtt_client = aiomqtt.Client(
        "test.mosquitto.org",
        protocol=aiomqtt.ProtocolVersion.V5,
    )
    app = fastcc.FastCC(mqtt_client)
    app.add_router(router)
    app.add_injector(database=database)

    async with mqtt_client:
        await app.run()


# https://github.com/empicano/aiomqtt?tab=readme-ov-file#note-for-windows-users
if sys.platform.lower() == "win32" or os.name.lower() == "nt":
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

with contextlib.suppress(KeyboardInterrupt):
    asyncio.run(main())

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

fastcc-1.0.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

fastcc-1.0.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file fastcc-1.0.1.tar.gz.

File metadata

  • Download URL: fastcc-1.0.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for fastcc-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5a9276ec2c00cfe9053935e584f5fef45c8086abf94734c0c394aae41da6121f
MD5 4ae3c484ff69319e68b4d99b148622f7
BLAKE2b-256 efd98f9340f74a2cc64bfe96be2561957171622355999a2f4a87900178849670

See more details on using hashes here.

File details

Details for the file fastcc-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: fastcc-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for fastcc-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d77ce9159159cc226a6c0f451d247b3394c38f8f3c1979893b00755453d3c490
MD5 9e6fb507ccd303fb78bfbebdbc4daf1c
BLAKE2b-256 d23a03c52e25531bacc1dd5bb688d0c792579bad9909f973d7267b4989af4c60

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