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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gsm_sms-0.1.0.tar.gz (73.0 kB view details)

Uploaded Source

Built Distribution

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

gsm_sms-0.1.0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file gsm_sms-0.1.0.tar.gz.

File metadata

  • Download URL: gsm_sms-0.1.0.tar.gz
  • Upload date:
  • Size: 73.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for gsm_sms-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9a8fede232e48809dbd662ab81c99a2b4c28d840d48b5711a64b498902adcde3
MD5 c7d5ae21c5f1dd481ee37be76ba82627
BLAKE2b-256 13813d0822ebcb856a8051a651917d913812ce9c636a9011d029bb2ce63944d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsm_sms-0.1.0.tar.gz:

Publisher: release.yml on jag-k/gsm-sms

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

File details

Details for the file gsm_sms-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gsm_sms-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for gsm_sms-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a52d6c65a65019e3124a2f523e153b4ed3e2f5a018c82459d423bab4a5cf3dc9
MD5 65530c4df9d9edc2b784b71fb288297a
BLAKE2b-256 93e4704e1a99a1b57e59e08a615c3a06b5eaa2f9b76bec5a30853baee93f77e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsm_sms-0.1.0-py3-none-any.whl:

Publisher: release.yml on jag-k/gsm-sms

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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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