Skip to main content

cosalette

cosalette — An opinionated Python framework for IoT-to-MQTT bridges

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.12.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 cosalette 0.12.1
File Size Uploaded
cosalette-0.12.1.tar.gz 852.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for cosalette 0.12.1
File
cosalette-0.12.1-cp314-abi3-win_amd64.whl CPython 3.14 abi3 Windows x86-64 Details
cosalette-0.12.1-cp314-abi3-musllinux_1_2_x86_64.whl CPython 3.14 abi3 Linux musl 1.2+ x86-64 Details
cosalette-0.12.1-cp314-abi3-musllinux_1_2_armv7l.whl CPython 3.14 abi3 Linux musl 1.2+ ARMv7l Details
cosalette-0.12.1-cp314-abi3-musllinux_1_2_aarch64.whl CPython 3.14 abi3 Linux musl 1.2+ ARM64 Details
cosalette-0.12.1-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 abi3 Linux glibc 2.17+ x86-64 Details
cosalette-0.12.1-cp314-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.14 abi3 Linux glibc 2.17+ ARMv7l Details
cosalette-0.12.1-cp314-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.14 abi3 Linux glibc 2.17+ ARM64 Details
cosalette-0.12.1-cp314-abi3-macosx_11_0_arm64.whl CPython 3.14 abi3 macOS 11.0+ ARM64 Details
cosalette-0.12.1-cp314-abi3-macosx_10_12_x86_64.whl CPython 3.14 abi3 macOS 10.12+ x86-64 Details

Total release size: 14.1 MB

Release files / cosalette-0.12.1.tar.gz

Download URL cosalette-0.12.1.tar.gz
Size 852.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1873cb62f18c23c8820ec0778de0fbe1b5c8793f80179080102fa89d6f9f751a
BLAKE2b-256 checksum
How to use checksums
82a9143f2657fa3015f11273dcb330e9fbc31f8fa89b55b839307fb4a2afd7d0
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 13, 2026.

Transparency log

Release files / cosalette-0.12.1-cp314-abi3-win_amd64.whl

Download URL cosalette-0.12.1-cp314-abi3-win_amd64.whl
Size 1.2 MB
Tags CPython 3.14 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7dda2d0e3d54dab89cd92764c601136f79cced728e6588947e9b6617dee9cd54
BLAKE2b-256 checksum
How to use checksums
e1a0a0468e82758644064ecc106014ec056c1101d59ba06fc7bf8df5ebd6eaed
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 13, 2026.

Transparency log

Release files / cosalette-0.12.1-cp314-abi3-musllinux_1_2_x86_64.whl

Download URL cosalette-0.12.1-cp314-abi3-musllinux_1_2_x86_64.whl
Size 1.7 MB
Tags CPython 3.14 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
3488133bd9c47b570e380e102c69d07a7ae100dfc4554a612393df5ff8028ca4
BLAKE2b-256 checksum
How to use checksums
dbb8c1f191413e8d02ffd8c246c733df76a351cf7218113e7e1f564a511921a8
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 13, 2026.

Transparency log

Release files / cosalette-0.12.1-cp314-abi3-musllinux_1_2_armv7l.whl

Download URL cosalette-0.12.1-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
fb82592565dfcc6b674c8450d69ac987cebff58aa68c2b8d2e7578107ae947ac
BLAKE2b-256 checksum
How to use checksums
0dfb8817731fa910359273b5ca3cb8ca5f43a7eff8742e9e555e41a5c6ea58db
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 13, 2026.

Transparency log

Release files / cosalette-0.12.1-cp314-abi3-musllinux_1_2_aarch64.whl

Download URL cosalette-0.12.1-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
646e91d5e786d0e146b2e98d47de9a97f5a28c05f24a516d2414eb1a9e312b1d
BLAKE2b-256 checksum
How to use checksums
e7d2eac0b4e7b9e09d3ef18b8e127a4b8e1f45c7602ddf2a1e8a6c8ceda2d0ad
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 13, 2026.

Transparency log

Release files / cosalette-0.12.1-cp314-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cosalette-0.12.1-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
5e1806528f140ba078c5f18b3961557b95714dbfd6d89ae33ee8ab52b325c931
BLAKE2b-256 checksum
How to use checksums
c3dfa43b9f18b202eed8804f8a5a7e70c0cff04727c1950787c82d8a0569fc8c
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 13, 2026.

Transparency log

Release files / cosalette-0.12.1-cp314-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL cosalette-0.12.1-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
d2406bfd3fb828a4010508dfb992bc67423499e7bf7af8be3062346f7becc566
BLAKE2b-256 checksum
How to use checksums
f81618e5a0045cf7795695da8a667c55a8de10e5a16f8d2926b0d7ffd00246b2
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 13, 2026.

Transparency log

Release files / cosalette-0.12.1-cp314-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL cosalette-0.12.1-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
657c78f06c7a18e851b5e99e2c89f41c18bfa38eef451e8cbbef07c131c2b35d
BLAKE2b-256 checksum
How to use checksums
41c06a9f8c642c4481c32b1f3c92d44883173952091e3712fd528624f940e1cf
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 13, 2026.

Transparency log

Release files / cosalette-0.12.1-cp314-abi3-macosx_11_0_arm64.whl

Download URL cosalette-0.12.1-cp314-abi3-macosx_11_0_arm64.whl
Size 1.4 MB
Tags CPython 3.14 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f23790c370110127c04b709b55557ba8b26ab8fe34ca0dee7eee0e86d1ff53e7
BLAKE2b-256 checksum
How to use checksums
c21cae55c392466f9e4bbcc429db8f4cbaf6742c909ea82762429d336ea1e02d
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 13, 2026.

Transparency log

Release files / cosalette-0.12.1-cp314-abi3-macosx_10_12_x86_64.whl

Download URL cosalette-0.12.1-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
524fe8b5ea3681e5f3b524dc9619c8b451fa30ffa433e4c2bb0a7235fd85ed93
BLAKE2b-256 checksum
How to use checksums
0753ed55a5723572d62c257d4e011912192b3c0a62ad8cc93e04fc64d2f2dc51
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 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.12.1 This release

10 release files

0.10.5

9 release files

0.10.4

9 release files

0.10.3

9 release files

0.10.2

9 release files

0.10.1

9 release files

0.10.0

9 release files

0.9.6

9 release files

0.9.5

9 release files

0.9.4

9 release files

0.9.3

9 release files

0.9.2

9 release files

0.9.1

9 release files

0.9.0

9 release files

0.8.0

9 release files

0.7.1

9 release files

0.7.0

9 release files

0.6.3

9 release files

0.6.2

9 release files

0.6.1

9 release files

0.6.0

9 release files

0.5.9

9 release files

0.5.8

9 release files

0.5.7

9 release files

0.5.6

9 release files

0.5.5

9 release files

0.5.4

9 release files

0.5.3

9 release files

0.5.2

9 release files

0.5.1

9 release files

0.5.0

9 release files

0.4.5

9 release files

0.4.4

9 release files

0.4.3

9 release files

0.4.2

9 release files

0.4.0

9 release files

0.3.12

9 release files

0.3.11

9 release files

0.3.10

9 release files

0.3.9

9 release files

0.3.8

9 release files

0.3.7

9 release files

0.3.6

9 release files

0.3.5

9 release files

0.3.4

9 release files

0.3.3

9 release files

0.3.2

9 release files

0.3.1

9 release files

0.3.0

9 release files

0.2.1

13 release files

0.2.0

12 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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