matrix-nio
A Python Matrix client library, designed according to sans I/O principles.
What it is and what it does
matrix-nio is a multilayered Matrix protocol client library that separates the protocol logic (sans-IO base layer) from the network transport (asyncio/aiohttp layer). It handles the full lifecycle of Matrix client operations—authentication, room management, message synchronization, and user presence—with built-in support for end-to-end encryption when the optional libolm dependency is installed.
The library is designed for developers building bots, bridges, or interactive clients that need to connect to Matrix homeservers. It provides type hints throughout, supports custom authentication flows, and includes features like typing notifications, read receipts, message redaction, and emoji verification. File uploads and downloads are encrypted when E2EE is enabled. The package depends on aiohttp for HTTP, aiofiles for async file operations, h11 and h2 for HTTP protocol handling, jsonschema for validation, and pycryptodome for cryptographic operations.
Use it for:
- Build a Matrix chat bot that listens to room messages and responds based on commands or triggers
- Create a bridge between Matrix and another chat platform by syncing messages bidirectionally
- Develop a custom Matrix client UI with end-to-end encryption support for secure messaging
- Monitor Matrix rooms programmatically and log or alert on specific message patterns
- Automate user registration and room management tasks on a Matrix homeserver
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
matrix-nio is an asyncio-based Python client library for the Matrix protocol, providing end-to-end encryption support, room management, and real-time synchronization with Matrix homeservers.
Yes. matrix-nio is actively maintained, has low install friction, no known vulnerabilities, and a permissive license. It is the standard choice for Python developers building Matrix clients or bots. Install without hesitation if you need Matrix protocol support; add the [e2e] extra only if you need end-to-end encryption and can install libolm on your system.
Install
matrix-nio on PyPI
pip
pip install matrix-niouv
uv add matrix-niopoetry
poetry add matrix-nioInstalling matrix-nio
Before you install
Low friction install with a pure-Python wheel; active maintenance with a recent release 22 days ago. Optional E2EE support requires the libolm C library (version 3.x) installed separately via system package manager.
License in practice
Licensed under the Internet Systems Consortium license (ISC), a permissive open-source license similar to MIT. No notable restrictions for commercial or private use.
Quickstart
pip install matrix-nio
import asyncio
from nio import AsyncClient
async def main():
client = AsyncClient("https://matrix.org", "@user:matrix.org")
await client.login("password")
await client.sync()
await client.close()
asyncio.run(main())
Requires Python 3.10 or later. For end-to-end encryption, libolm C library (version 3.x) must be installed system-wide before installing matrix-nio[e2e].
Verify before relying
- Whether cross-signing and server-side key backup features are planned or deprioritized
- Performance characteristics under high message volume or large room counts
- Compatibility with non-standard or older Matrix homeserver implementations
Package facts
| License | Internet Systems Consortium license =================================== Copyright (c) `2018`, `Damir Jelić <poljar@termina.org.uk>` Permission to use, copy, modify, and/or distribute this software… (full text in the JSON record) (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — aiohttp, aiofiles, h11, h2, jsonschema, unpaddedbase64, pycryptodome, aiohttp-socks |
| Maintenance | actively maintained — 22 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 943,808/month — #4,671 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: matrix_nio-0.26.0-py3-none-any.whl
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
matrix-clientPython client library for connecting to and…
permissive · top 15,000 on PyPI
mautrixAn asyncio Matrix framework for Python that…
copyleft · top 5,000 on PyPI
vodozemacProvides Python bindings for vodozemac, a…
unclear · top 15,000 on PyPI
matrix-synapseMatrix Synapse is a homeserver implementation…
unclear · top 15,000 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
aiorecollectAsyncio-based Python library for querying waste…
permissive · top 15,000 on PyPI
aioridwellAn asyncio-based Python library for querying…
permissive · top 15,000 on PyPI
python-olmPython bindings for the Olm cryptographic…
permissive · top 5,000 on PyPI
aiosignalProvides a Signal class for managing lists of…
permissive · top 100 on PyPI
sqlcipher3sqlcipher3 is a Python DB-API 2.0 interface to…
permissive · top 15,000 on PyPI