Skip to main content

SimpleX Chat Python library

Python 3.11+ client for SimpleX Chat bots. Equivalent to the Node.js library.

Install

pip install simplex-chat

The native libsimplex is downloaded lazily on first use. To pre-fetch:

python -m simplex_chat install                     # sqlite (default)
python -m simplex_chat install --backend postgres  # linux-x86_64 only

Quick start

import re
from simplex_chat import Bot, BotProfile, Message, SqliteDb, TextMessage

bot = Bot(
    profile=BotProfile(display_name="Squaring bot"),
    db=SqliteDb(file_prefix="./squaring_bot"),
    welcome="Send me a number, I'll square it.",
)

@bot.on_message(content_type="text", text=re.compile(r"^-?\d+(\.\d+)?$"))
async def square(msg: TextMessage) -> None:
    n = float(msg.text or "0")
    await msg.reply(f"{n} * {n} = {n * n}")

@bot.on_message(content_type="text")
async def fallback(msg: Message) -> None:
    await msg.reply("Send me a number, like 7 or 3.14.")

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

bot.run() blocks. The connection address is logged on startup — paste it into a SimpleX client to talk to the bot. Ctrl+C to stop.

Three decorators: @bot.on_message(...), @bot.on_command(name), @bot.on_event(tag). Message handlers are first-match-wins in registration order, so register specific filters first and catch-alls last.

See examples/squaring_bot.py for the full example.

Development

uv venv && source .venv/bin/activate
uv pip install -e '.[dev]'
ruff check && pyright && pytest tests/

Wire types under src/simplex_chat/types/_*.py are generated. Regenerate with cabal test simplex-chat-test --test-options='--match Python'.

License

AGPL-3.0

Metadata

Release files for simplex-chat 7.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simplex-chat 7.1.3
File Size Uploaded Provenance Actions
simplex_chat-7.1.3.tar.gz 97.0 kB With provenance Details for simplex_chat-7.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simplex-chat 7.1.3
File Interpreter ABI Platform Actions
simplex_chat-7.1.3-py3-none-any.whl Python 3 none any Details for simplex_chat-7.1.3-py3-none-any.whl

Total release size: 178.4 kB

Release files / simplex_chat-7.1.3.tar.gz

Download URL simplex_chat-7.1.3.tar.gz
Size 97.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6b62ed16510260762dba771700a3dee847cf3234aced2a849ce2bb22b803aa30
BLAKE2b-256 checksum
How to use checksums
d056e277e23d242530980b14877c26a87c76753cfcf47219ace327d669ccb839
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Release files / simplex_chat-7.1.3-py3-none-any.whl

Download URL simplex_chat-7.1.3-py3-none-any.whl
Size 81.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b98f8ecc1e24fbf1b2d171297ed23031ac46d3b90f435b6e9f2de23fc8e38ed
BLAKE2b-256 checksum
How to use checksums
657354b7ed750297e818773d17c7afc54498fe9ba4f8f06db7dadbe646d94fea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Security for simplex-chat 7.1.3

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for simplex_chat-7.1.3.tar.gz

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 Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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