Skip to main content

CometTextel — Python (thin FFI)

Thin ctypes binding to the same C ABI as the C SDK and CometTextel.NET (c_api.h).
This is not a second native library: it runtime-loads comettextel.dll / libcomettextel.so.

Covers PDU helpers and GsmModem (open / send / list / delete).
Hardware modem tests are optional; smoke tests run without a device.

Python

Layout

sdk/python/
├── comettextel/              # package (ctypes + PDU + modem)
├── examples/
│   ├── pdu_example.py        # encode / decode + self-check
│   └── modem_example.py      # list / send / delete
├── tests/
│   ├── test_pdu.py
│   └── test_modem.py
└── README.md

Prerequisites

Item Detail
Python 3.10+ (3.13 verified)
Native C SDK shared library (comettextel.dll or libcomettextel.so)
Modem (optional) AT modem in PDU mode (e.g. COM3, /dev/ttyUSB0)

Download comettextel-c-sdk-* from CI Artifacts or a GitHub Release, or use a local CMake build.

Finding the library

Search order:

  1. Explicit path passed to comettextel.pdu.load_library(...)
  2. Environment variable COMETTEXTEL_LIB (file or directory)
  3. Current working directory
  4. Nearby build / artifact folders (build-c-sdk/Release, artifact/comettextel-c-sdk-*/…)
# Windows
$env:COMETTEXTEL_LIB = "D:\path\to\comettextel.dll"
# Linux
export COMETTEXTEL_LIB=/path/to/libcomettextel.so

PDU example

cd sdk\python
python examples\pdu_example.py
python examples\pdu_example.py 886912345678 "Hello" 886932000000
python examples\pdu_example.py 886912345678 "測試中文簡訊" 886932000000

Modem example

python examples\modem_example.py list COM3
python examples\modem_example.py send COM3 886932000000 886912345678 "Hello"
python examples\modem_example.py delete COM3 1

list rejoins complete concatenated SMS sets (concat_seq == 0 / Message.is_reassembled_concat).

Tests

cd sdk\python
pip install pytest
pytest -q

API sketch

from comettextel import DCS_UCS2, GsmModem, decode, encode_submit_segments

parts = encode_submit_segments("886912345678", "Hello", "886932000000", DCS_UCS2)
msg = decode(parts[0])

with GsmModem() as modem:
    modem.open("COM3", 115200)
    modem.send("886912345678", "Hello from Python", smsc="886932000000")
    for m in modem.list():
        print(m.index, m.peer_address, m.user_data, m.is_reassembled_concat)

All text at the native boundary is UTF-8. Do not reimplement PDU codecs in Python; if the C ABI changes, update this package only.

See also

Metadata

Release files for comettextel 1.3.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 comettextel 1.3.0
File Size Uploaded
comettextel-1.3.0.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for comettextel 1.3.0
File Interpreter ABI Platform
comettextel-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / comettextel-1.3.0.tar.gz

Download URL comettextel-1.3.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
61db442475ee786fb18d5c42e193f66e9b0763bc6a94675da567810f2c4a2a57
BLAKE2b-256 checksum
How to use checksums
a5bfafb9b2c42bdcad41e58905b3b304c9aaf871f3395b11c460d1bd742d6218
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / comettextel-1.3.0-py3-none-any.whl

Download URL comettextel-1.3.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a0e83d8374f12e4b75a5e272ad27f5aa72e3ff6d3dd8295a12720aa0c785020
BLAKE2b-256 checksum
How to use checksums
9fba356dc2afb13d62e8d8daaaf8437a19f7d0b467f57e071586bac74cc763b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release history Release notifications | RSS feed

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

This release

1.3.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