Skip to main content

gsm-sms

Async Python library that exclusively owns a GSM modem serial port. It serializes AT commands, decodes text/PDU and multipart SMS, emits typed events, and deletes incoming messages only after ack_incoming().

from gsm_sms.core.events import IncomingSmsEvent
from gsm_sms.core.modem import GsmSms

modem = GsmSms(port="/dev/ttyUSB0")
await modem.start()

async for event in modem.events():
    if isinstance(event, IncomingSmsEvent):
        await deliver(event.message)
        await modem.ack_incoming(event.message.id)

Install the library with pip install gsm-sms. Applications that talk to a gateway instead of opening the modem use pip install "gsm-sms[client]" and gsm_sms.client.GatewayClient.

Gateway with Docker Compose

The gateway is a separate, Docker-only REST/SSE service. It persists events and send operations in SQLite, supports resumable SSE cursors, and must remain the only process using the modem.

services:
  gateway:
    image: ghcr.io/jag-k/gsm-sms-gateway:latest
    restart: unless-stopped
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
    environment:
      MODEM__SERIAL_PORT: /dev/ttyUSB0
      MODEM__BAUD_RATE: "115200"
      MODEM__SMS_STORAGE: SM
      JOURNAL__DATABASE_PATH: /data/gateway.sqlite3
    volumes:
      - ./data:/data
    ports:
      - 127.0.0.1:8000:8000
    networks:
      - gsm-sms

networks:
  gsm-sms:
    name: gsm-sms-network
docker compose up -d
curl http://127.0.0.1:8000/v1/health

For all environment variables, see docs/gateway/Configuration.md. The published Python package intentionally excludes FastAPI, Docker, Telegram, and Matrix.

Metadata

Release files for gsm-sms 0.1.0

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

Source distribution (sdist)

Source distribution for gsm-sms 0.1.0
File Size Uploaded
gsm_sms-0.1.0.tar.gz 73.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gsm-sms 0.1.0
File Interpreter ABI Platform
gsm_sms-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 95.7 kB

Release files / gsm_sms-0.1.0.tar.gz

Download URL gsm_sms-0.1.0.tar.gz
Size 73.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9a8fede232e48809dbd662ab81c99a2b4c28d840d48b5711a64b498902adcde3
BLAKE2b-256 checksum
How to use checksums
13813d0822ebcb856a8051a651917d913812ce9c636a9011d029bb2ce63944d8
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 Aug 3, 2026.

Transparency log

Release files / gsm_sms-0.1.0-py3-none-any.whl

Download URL gsm_sms-0.1.0-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a52d6c65a65019e3124a2f523e153b4ed3e2f5a018c82459d423bab4a5cf3dc9
BLAKE2b-256 checksum
How to use checksums
93e4704e1a99a1b57e59e08a615c3a06b5eaa2f9b76bec5a30853baee93f77e1
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 Aug 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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