Skip to main content

kiss3 - Python KISS Module

https://github.com/python-aprs/kiss3/actions/workflows/pytest.yml/badge.svg

kiss3 talks KISS to TNCs over serial ports and TCP (Dire Wolf, hardware TNCs, Bluetooth TNCs), with plain blocking calls or asyncio. It frames and unframes AX.25 data and sends TNC parameters. It needs Python 3.11 or newer.

Install it from PyPI:

pip install kiss3

For APRS decoding on top of KISS, use aprs3.

Sending and receiving

TCPKISS and SerialKISS block. start() connects and writes any TNC parameters you pass, write() returns once the frame has gone out, and read() waits for frames:

from ax253 import Frame

import kiss

tnc = kiss.TCPKISS("localhost", 8001, strip_df_start=True)  # Dire Wolf
# or: kiss.SerialKISS("/dev/ttyUSB0", 9600, strip_df_start=True)
tnc.start(TX_DELAY=40)
try:
    tnc.write(Frame.from_str("N0CALL>APRS,WIDE1-1:>on the air"))
    for raw in tnc.read(min_frames=1):
        print(Frame.from_bytes(raw))
finally:
    tnc.stop()

strip_df_start=True removes the KISS command byte and drops frames that aren’t data. Without it, each frame still starts with the command byte (0x00 for data on port 0) and Frame.from_bytes() fails with an error like b'\x00VE3YC' does not match ....

With asyncio, create_tcp_connection and create_serial_connection return a KISSProtocol whose read() yields ax253.Frame objects:

import asyncio

import kiss


async def main():
    transport, protocol = await kiss.create_tcp_connection("localhost", 8001)
    async for frame in protocol.read():
        print(frame)


asyncio.run(main())

Decoding a byte stream

If you read the bytes yourself, the decoders turn them into frames as they arrive:

>>> from ax253 import Frame
>>> import kiss
>>> stream = b"\xc0\x00" + bytes(Frame.from_str("N0CALL>APRS:>hi")) + b"\xc0"
>>> decoder = kiss.AX25KISSDecode()
>>> list(decoder.update(stream[:10]))
[]
>>> [str(frame) for frame in decoder.update(stream[10:])]
['N0CALL>APRS:>hi']

Detecting a lost connection

read(min_frames=None) blocks until the connection closes, then returns the frames that were left. Check connected to tell a closed connection from a quiet one, and call stop() and start() to reconnect:

while True:
    tnc.read(callback=print, min_frames=None)
    if not tnc.connected:
        tnc.stop()
        tnc.start()

A TCP peer that disappears without closing the connection (network cable pulled, host crashed) is only noticed when a write fails or the operating system’s TCP keepalive gives up.

Examples

The examples directory has two scripts that work with any KISS TNC, given --tcp host:port or --serial device:

  • kiss_monitor.py prints every frame the TNC hears.

  • kiss_send.py sends frames given in TNC2 text, and can set TNC parameters like --set TX_DELAY=40.

Versions

8.x is published by python-aprs as kiss3. Earlier versions were released by Greg Albrecht as kiss.

Testing

Run the tests with uv:

uv run pytest

Source

GitHub: https://github.com/python-aprs/kiss3

Authors

Greg Albrecht W2GMD oss@undef.net

http://ampledata.org/

Masen Furer KF7HVM kf7hvm@0x26.net

License

Apache License, Version 2.0. See LICENSE for details.

Metadata

Release files for kiss3 8.1.1

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

Source distribution (sdist)

Source distribution for kiss3 8.1.1
File Size Uploaded Provenance Actions
kiss3-8.1.1.tar.gz 64.3 kB Without provenance Details for kiss3-8.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 78.9 kB

Release files / kiss3-8.1.1.tar.gz

Download URL kiss3-8.1.1.tar.gz
Size 64.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e0455542b8663d99c3a179aa10707a54029e62f517fff43307623fc8da405963
BLAKE2b-256 checksum
How to use checksums
ec5bb908e7d04ee58310cae6bd6f0be5583f5b7ee38a84eb0b0302ba0511caf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / kiss3-8.1.1-py3-none-any.whl

Download URL kiss3-8.1.1-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49a84632fef5918f70e413259c435d29652de849e3656dc59d4f0cb0c0ebcc1c
BLAKE2b-256 checksum
How to use checksums
6fd98da1013222b2c191164a9b475eb7fb5803e6db90d7e82219beabc15504bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for kiss3 8.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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