Skip to main content

an opinionated Python framework for building IoT-to-MQTT bridge applications

Project description

cosalette

An opinionated Python framework for building IoT-to-MQTT bridge applications.

CI Docs PyPI License: MIT Python

Documentation · Quickstart · API Reference


What is cosalette?

cosalette lets you build IoT-to-MQTT bridge daemons in Python with minimal boilerplate. You define devices (telemetry pollers or command handlers), register hardware adapters, and the framework handles MQTT wiring, structured logging, health reporting, error publishing, and graceful lifecycle management.

Key Features

  • Declarative device registration@app.command(), @app.device(), and @app.telemetry() decorators (guide)
  • Hexagonal architecture — protocol-based ports with swappable adapters (concept)
  • Structured JSON logging — per-device context, configurable levels (concept)
  • Health & heartbeats — LWT crash detection, periodic JSON heartbeats, per-device availability (concept)
  • Structured error publishing — domain errors published to MQTT with type mapping (concept)
  • Pydantic settings — type-safe configuration from env vars and .env files (guide)
  • CLI for free--dry-run, --version, --log-level, --env-file via Typer (reference)
  • Test-friendlyMockMqttClient, FakeClock, pytest fixtures included (guide)

Quick Example

import cosalette

app = cosalette.App(name="weather2mqtt", version="0.1.0")

@app.telemetry("sensor", interval=5.0)
async def sensor() -> dict[str, object]:
    return {"temperature": 21.5, "humidity": 55.0}

if __name__ == "__main__":
    app.run()

See the full Quickstart for a complete walkthrough.

Installation

pip install cosalette

Or with uv:

uv add cosalette

Contributing

See CONTRIBUTING.md for development setup, commands, project structure, and code quality standards.

Documentation

Full documentation is published at ff-fab.github.io/cosalette.

Section What you'll find
Getting Started Installation, quickstart tutorial
Concepts Architecture, MQTT topics, lifecycle, hexagonal design
How-To Guides Step-by-step guides for each feature
Reference API docs, CLI options, payload schemas
ADRs Architecture Decision Records

License

MIT License. See LICENSE for details.

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

cosalette-0.1.3.tar.gz (342.7 kB view details)

Uploaded Source

Built Distribution

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

cosalette-0.1.3-py3-none-any.whl (52.0 kB view details)

Uploaded Python 3

File details

Details for the file cosalette-0.1.3.tar.gz.

File metadata

  • Download URL: cosalette-0.1.3.tar.gz
  • Upload date:
  • Size: 342.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cosalette-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c9627a66ac6b247f7766d39bdcf0026a9e2e97b91155092dfe9e4366f22c2a36
MD5 fdfea920f5e2d56dc2c41259f023a28a
BLAKE2b-256 6466cd18e0fdb4446337deba50eed83433c78d425602c8965ded43b8f7dea7b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for cosalette-0.1.3.tar.gz:

Publisher: release-please.yml on ff-fab/cosalette

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cosalette-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: cosalette-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 52.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cosalette-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a9191a378b558c15888ab0aeb4e84662ff3d149684e3f02d98a9d5167cf1a8c1
MD5 0ca6bc01e8a0d1b697b0ee74f5d518a2
BLAKE2b-256 08ba62f609c2638781c4d05b75bc713c0b8ff87fb282cfb9c606b8f031238b33

See more details on using hashes here.

Provenance

The following attestation bundles were made for cosalette-0.1.3-py3-none-any.whl:

Publisher: release-please.yml on ff-fab/cosalette

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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