cosalette
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.
Quick Example
import cosalette
app = cosalette.App(name="sensor2mqtt", 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.
Router Composition (Multi-Module Apps)
For production apps, use Router to organize devices into separate modules without
circular imports:
# sensors.py
import cosalette
router = cosalette.Router(prefix="sensors")
@router.telemetry("temperature", interval=30)
async def read_temp() -> dict[str, object]:
return {"celsius": 22.5}
# main.py
import cosalette
from sensors import router
app = cosalette.App(name="home2mqtt", version="1.0.0")
app.include_router(router)
# → publishes to: home2mqtt/sensors/temperature/state
See Router Composition for full patterns.
Typed Contracts & Schema Inspection
cosalette supports Pydantic-validated payloads and typed returns for type-safe command handlers and telemetry, plus dependency injection for shared logic:
from typing import Annotated
from pydantic import BaseModel
import cosalette
app = cosalette.App(name="thermo2mqtt", version="1.0.0")
class SetpointCommand(BaseModel):
value: float
unit: str = "celsius"
class ThermostatState(BaseModel):
setpoint: float
unit: str
def get_device_id() -> str:
return "thermo-001"
@app.command("thermostat/set")
async def set_temp(
cmd: Annotated[SetpointCommand, cosalette.Payload()],
device_id: Annotated[str, cosalette.Depends(get_device_id)],
) -> ThermostatState:
return ThermostatState(setpoint=cmd.value, unit=cmd.unit)
Inspect the contract to generate AsyncAPI docs or consumer artifacts:
cosalette manifest myapp.main:app # JSON AsyncAPI 3.0.0
cosalette manifest myapp.main:app --table # human-readable table
Or programmatically:
doc = app.asyncapi() # returns dict conforming to AsyncAPI 3.0.0
See Contract-First Route Design and Schema Enforcement for full details.
Key Features
- Declarative device registration — define telemetry and command devices with
@app.telemetry(),@app.command(), and@app.device()(guide) - Hexagonal architecture — protocol-based ports keep hardware adapters swappable and testable (concept)
- Lifespan + dependency injection — structured startup/teardown and type-based DI for adapters, settings, and shared state (guide)
- Command routing — use sub-topic handlers and
ctx.commands()for clean control flows (guide) - Flexible scheduling — combine fixed intervals, Quartz cron, and
ctx.sleep_until()wall-clock timing - Publish strategies — emit on change, on cadence, or with composed rules (concept)
- Health checks + auto-restart — monitor adapters and recover from wedged hardware automatically (concept)
- Persistence — store state with JSON, SQLite, or in-memory backends plus save policies (concept)
- Schema-aware integrations — validate payloads and generate consumer artifacts from AsyncAPI schemas (guide)
- AI-assisted development — optional MCP tools plus packaged instructions for Copilot and other IDE-native agents (guide)
Installation
pip install cosalette
Or with uv:
uv add cosalette
To include the optional MCP server for IDE-native AI agent integration (VS Code Copilot, Cursor, Windsurf, Claude Code):
uv add 'cosalette[mcp]'
pip install 'cosalette[mcp]'
See the MCP Server guide for setup and tool reference.
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. Development docs
tracking the main branch are available at
Dev Docs (latest).
| Section | What you'll find |
|---|---|
| Getting Started | Installation, quickstart tutorial |
| Concepts | Architecture, lifecycle, health checks, filters, persistence |
| How-To Guides | Telemetry, commands, adapters, lifespan DI, schema, testing, MCP |
| Reference | API docs, CLI options, payload schemas |
| ADRs | Architecture Decision Records |
License
MIT License. See LICENSE for details.
Metadata
Release files for cosalette 0.11.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cosalette-0.11.2.tar.gz | 820.7 kB | Details |
Built distributions (wheels)
Total release size: 13.8 MB
Release files / cosalette-0.11.2.tar.gz
| Download URL | cosalette-0.11.2.tar.gz |
|---|---|
| Size | 820.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab75517e6d85559c4a24d3d4b31e4920ad00204c2b2d1c934ed8dc07e19f52fc
|
|
BLAKE2b-256 checksum How to use checksums |
67483282ef2570c9386b6d3f4aa8c41b0f52ed5c70731c823e921232bf88b4f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / cosalette-0.11.2-cp314-abi3-win_amd64.whl
| Download URL | cosalette-0.11.2-cp314-abi3-win_amd64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.14 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e6d5a10dcde5b0914d74b5058cd450f8d54856dad8a5d95ebb5da4a84b0b176d
|
|
BLAKE2b-256 checksum How to use checksums |
e579afe0fb0abb62c14d072bc02fed262abf05f2186ed8ee5d20e9378468d126
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / cosalette-0.11.2-cp314-abi3-musllinux_1_2_x86_64.whl
| Download URL | cosalette-0.11.2-cp314-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.14 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2e5835f37fe7edc23f5a1103d66a3d2fd476da2128896d23d1eeff5ed5b4b992
|
|
BLAKE2b-256 checksum How to use checksums |
d30c3bc7b20c8b44fb31ab8d688edf2657642af39945428ca5fc04b448fdd203
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / cosalette-0.11.2-cp314-abi3-musllinux_1_2_armv7l.whl
| Download URL | cosalette-0.11.2-cp314-abi3-musllinux_1_2_armv7l.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.14 Linux musl 1.2+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
33b081a2466f40be98b8e2bffe596aecc634e30551460da42e0fc9b7cfea0f0b
|
|
BLAKE2b-256 checksum How to use checksums |
b1f4e497a1be2e886e220ba584c241feeb5ef1bfa395e8f12593ed46a88f738a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / cosalette-0.11.2-cp314-abi3-musllinux_1_2_aarch64.whl
| Download URL | cosalette-0.11.2-cp314-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.14 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0756d7643b9d82be1b38e8c53783691c87b62cfa20f5bf0aa8232be25f45f3ae
|
|
BLAKE2b-256 checksum How to use checksums |
f4197c68df90076f08731a53057812bb1af8aeefec0ac4e7fad72c3b63694f67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / cosalette-0.11.2-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cosalette-0.11.2-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
84e47d184deb953a36e0c1627942ffab07a4d6fdb0628c12e2b5ef33e76b6020
|
|
BLAKE2b-256 checksum How to use checksums |
31f095424069d3d516b6dca11dbbff4d359b9414b13308268a997e5e8479a6c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / cosalette-0.11.2-cp314-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | cosalette-0.11.2-cp314-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
b0547475a84c65597aaf06a1d16a56ebf144e24fec7c64a10aab97199e336421
|
|
BLAKE2b-256 checksum How to use checksums |
8d71fb42388350f84b4d7339b808ca3b57eb6a85eac3ce137cb561a14cac6372
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / cosalette-0.11.2-cp314-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | cosalette-0.11.2-cp314-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
ec01ce13b854db9f66d501c29622e6880ea44025287f9a1dbb64d8749f2fcc49
|
|
BLAKE2b-256 checksum How to use checksums |
5ad59621cee222189e39868431886f39d317b4698098f80ec190c726f2ac3835
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / cosalette-0.11.2-cp314-abi3-macosx_11_0_arm64.whl
| Download URL | cosalette-0.11.2-cp314-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.14 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
389a7b66435dff9ec7054b5c41ce83f687382355f390b1e8ba682ddb8c5793c7
|
|
BLAKE2b-256 checksum How to use checksums |
79ed7aee12dcbeb1b9d10a64e7e0310eb13b5c5f475d8b38e1f07451aae72284
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / cosalette-0.11.2-cp314-abi3-macosx_10_12_x86_64.whl
| Download URL | cosalette-0.11.2-cp314-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.14 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
6c981f5d2959e0df38bd0691e5b048d56fae2dd371a509c544636f55bda887d1
|
|
BLAKE2b-256 checksum How to use checksums |
7b36f8c372a227eadb9a18d5bc3d4d6ce8d15660d2282cf24e507ad6c4c7a745
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency log