Skip to main content

python-kv4p

Python implementation of the KV4P-HT radio protocol: KISS framing, the KV4P vendor envelope, and the Kv4pRadio orchestrator (HELLO handshake, flow control, PTT, device state tracking).

Targets the v2.0.0.1 Android/FW17 protocol line.

Full documentation: https://petrkr.github.io/python-kv4p/

Install

pip install python-kv4p

Usage

from kv4p import Kv4pRadio
from kv4p.transports.serial import Kv4pSerialTransport

transport = Kv4pSerialTransport("/dev/ttyUSB0", 115200)
radio = Kv4pRadio(transport)
radio.on_rx_audio(...)
radio.on_sql(...)

with radio:
    # radio.freq_rx / .bandwidth / .squelch / ... are seeded from the
    # firmware's actual tuned state, reported in HELLO right after connect().
    radio.set_frequency(145.500, 145.500)
    radio.set_tx_allowed(True)
    radio.set_ptt(True)
    radio.send_tx_audio(payload)
    radio.set_ptt(False)

Kv4pRadio context manager calls connect()/disconnect() automatically. connect() hardware-resets the ESP32 over RTS/DTR and blocks until HELLO is received, since the firmware only sends it once at boot — this is also how the radio’s settings properties get their initial values, straight from the firmware’s own DeviceState. Operations that need the handshake (set_frequency, set_bandwidth, set_squelch, set_ctcss, set_ptt, send_tx_audio, …) raise RadioNotReadyError if called before that.

For tests or hardware-free runs, use kv4p.transports.dummy.DummyTransport, which answers reset() with a synthetic HELLO.

Layout

kv4p/
  __init__.py       # Kv4pRadio, vendor encode/decode
  state_tracker.py  # DeviceStateTracker: handshake, device state, settings, PTT
  flow_control.py   # FlowControlWindow: HTTP/2-like flow control
  constants/        # numeric/bit constants (kiss, vendor, messages)
  protocol/         # wire framing: kiss.py
  messages/         # one file per KV4P payload (dataclasses)
  transports/       # Kv4pTransport interface, serial + dummy implementations

Metadata

Release files for python-kv4p 0.0.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 python-kv4p 0.0.1
File Size Uploaded Provenance Actions
python_kv4p-0.0.1.tar.gz 21.7 kB With provenance Details for python_kv4p-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-kv4p 0.0.1
File Interpreter ABI Platform Actions
python_kv4p-0.0.1-py3-none-any.whl Python 3 none any Details for python_kv4p-0.0.1-py3-none-any.whl

Total release size: 43.0 kB

Release files / python_kv4p-0.0.1.tar.gz

Download URL python_kv4p-0.0.1.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a70ffd9dd96ee21b113e308f1f8147625b799b56026cba028868831e51d564e0
BLAKE2b-256 checksum
How to use checksums
a1d0f460ff382ea4e637fa27e0e226e4d27f4a35194ee10811397c75f4abbfb6
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 21, 2026.

Transparency log

Release files / python_kv4p-0.0.1-py3-none-any.whl

Download URL python_kv4p-0.0.1-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26ffbeda8730e61ca90e5e2eac263aac90e450f8d0d9cc60063f648dca172a86
BLAKE2b-256 checksum
How to use checksums
0eb69a537bbf78899f9c4f22ba44fa1ae46d2897aea07d285936f5eba00f88da
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 21, 2026.

Transparency log

Security for python-kv4p 0.0.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.

Full provenance

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

Select from 2 files

Attestation for python_kv4p-0.0.1.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 Aug 21, 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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

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