Skip to main content

An easy-to-use Matrix bot framework designed for quick development and minimal setup

Project description

A simple, developer-friendly library to create powerful Matrix bots.
matrix.py

Join Discord Join Matrix Tests CodeQL Advanced OpenSSF Scorecard


Matrix.py is a lightweight and intuitive Python library to build bots on the Matrix protocol. It provides a clean, decorator-based API similar to popular event-driven frameworks, allowing developers to focus on behavior rather than boilerplate.

  • Minimal setup — install and have a working bot running in minutes
  • Event-driven — async/await API reacting to any Matrix room event
  • Command system — decorator-based commands with automatic argument parsing
  • Extensions — split your bot into modules as it grows

Quickstart

Requirements: Python 3.10+

pip install matrix-python

Using a virtual environment is strongly recommended:

python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install matrix-python

Create a config.yml:

USERNAME: "@yourbot:matrix.org"
PASSWORD: "your_password"
from matrix import Bot, Context

bot = Bot()


@bot.command("ping")
async def ping(ctx: Context):
    await ctx.reply("Pong!")


bot.start(config="config.yml")

Send !ping in any room the bot is in, it will reply Pong!.

Where to go next

  • Guides — step-by-step tutorials covering commands, events, checks, extensions, and more
  • Reference — complete API documentation for every class and function
  • Examples — ready-to-run example bots demonstrating common patterns

Contributing

We welcome everyone to contribute! Whether it's fixing bugs, suggesting features, or improving the docs. Every bit helps.

Please read the CONTRIBUTING.md and follow the code of conduct.

License

Released under the MIT License.

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

matrix_python-1.4.10a0.tar.gz (76.4 kB view details)

Uploaded Source

Built Distribution

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

matrix_python-1.4.10a0-py3-none-any.whl (31.6 kB view details)

Uploaded Python 3

File details

Details for the file matrix_python-1.4.10a0.tar.gz.

File metadata

  • Download URL: matrix_python-1.4.10a0.tar.gz
  • Upload date:
  • Size: 76.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for matrix_python-1.4.10a0.tar.gz
Algorithm Hash digest
SHA256 05ee91dcf1e2860ad24616e54fcb07f55ddf3d4a462b1efc3eb93006ceb8cf6d
MD5 7899140e182d56ff3c5bf53b4c12877b
BLAKE2b-256 f21949bb0ee41b67ebbde6c3cd4c0b63f4334478593f96777b9786868e4d64c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for matrix_python-1.4.10a0.tar.gz:

Publisher: publish.yml on Code-Society-Lab/matrixpy

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

File details

Details for the file matrix_python-1.4.10a0-py3-none-any.whl.

File metadata

File hashes

Hashes for matrix_python-1.4.10a0-py3-none-any.whl
Algorithm Hash digest
SHA256 188c54be020162091383ce1b2658b7b8f31d7f3e2427b72bb60a4c37536ac64f
MD5 f734ac7bbb4f80d3d5647b376d88d1f6
BLAKE2b-256 6d6e1cbe3ffe69be565f37330ce7fbd6f1e85e310d0c7f1f85d8a0ddd7042e5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for matrix_python-1.4.10a0-py3-none-any.whl:

Publisher: publish.yml on Code-Society-Lab/matrixpy

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