Skip to main content

aprs3 - Python APRS Module

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

aprs3 encodes and decodes APRS packets, and talks to APRS-IS servers and KISS TNCs (Dire Wolf, hardware TNCs) with asyncio or plain blocking calls. It needs Python 3.11 or newer.

Install it from PyPI:

pip install aprs3

Decoding packets

APRSFrame parses TNC2 text (what APRS-IS sends) or AX.25 bytes (what a TNC sends), and decodes the information field into a typed report:

>>> import aprs
>>> frame = aprs.APRSFrame.from_str(
...     "KF7HVM-9>APZ069,WIDE1-1:!4610.00N/12255.00W>090/025/A=000500 on the road"
... )
>>> type(frame.info).__name__
'PositionReport'
>>> round(float(frame.info.lat), 4), round(float(frame.info.long), 4)
(46.1667, -122.9167)
>>> frame.info.data_ext, frame.info.altitude_ft
(CourseSpeed(course=90, speed=25), 500)

The report types are:

  • PositionReport: compressed or uncompressed, with or without a timestamp, with altitude and a course/speed, PHG, RNG or DFS extension

  • ObjectReport and ItemReport

  • StatusReport

  • Message, including acks and rejects

>>> aprs.APRSFrame.from_str("KF7HVM>APZ069::N0CALL   :hello there{42").info
Message(raw=b':N0CALL   :hello there{42', data_type=<DataType.MESSAGE: b':'>, data=b'N0CALL   :hello there{42', comment=b'', addressee=b'N0CALL', text=b'hello there', number=b'42')

Other data types (telemetry, weather, Mic-E and so on) decode as a plain InformationField that keeps the raw bytes.

Encoding packets

Build a report, then wrap it in a frame with APRSFrame.ui. bytes(frame) is ready for a TNC, and str(frame) for APRS-IS:

>>> beacon = aprs.PositionReport(
...     raw=b"",
...     data=b"",
...     data_type=aprs.DataType.POSITION_W_O_TIMESTAMP_MSG,
...     position=aprs.Position(lat=46.1, long=-122.9, symbol_code=b"-"),
...     comment=b"Home station",
... )
>>> frame = aprs.APRSFrame.ui("APZ069", "N0CALL", ["WIDE1-1"], bytes(beacon))
>>> str(frame)
'N0CALL>APZ069,WIDE1-1:=4606.00N/12254.00W-Home station'

Connecting to APRS-IS

With asyncio, create_aprsis_connection logs in and protocol.read() yields decoded frames. A passcode of -1 is receive-only:

import asyncio

import aprs


async def main():
    transport, protocol = await aprs.create_aprsis_connection(
        host="rotate.aprs2.net",
        user="N0CALL",
        passcode="-1",
        command="filter r/46.1/-122.9/50",  # within 50 km
    )
    async for frame in protocol.read():
        print(frame)


asyncio.run(main())

Without asyncio, aprs.TCP takes the same arguments and blocks in read():

import aprs

with aprs.TCP(user="N0CALL", command="filter r/46.1/-122.9/50") as aprs_is:
    for frame in aprs_is.read(min_frames=3):
        print(frame.source, type(frame.info).__name__)

Connecting to a TNC

TCPKISS and SerialKISS (or create_tcp_connection and create_serial_connection with asyncio) speak KISS to a TNC and decode what it hears into APRSFrame objects. Dire Wolf listens for KISS on TCP port 8001:

import aprs

tnc = aprs.TCPKISS("localhost", 8001)
tnc.start()
try:
    tnc.write(aprs.APRSFrame.from_str("N0CALL>APZ069,WIDE1-1:>on the air"))
    for frame in tnc.read(min_frames=1):
        print(frame)
finally:
    tnc.stop()

For KISS without the APRS decoding, use kiss3.

Examples

The examples directory has scripts you can run:

  • aprs_decode.py prints a readable line for each packet given on the command line or piped in.

  • aprsis_monitor.py watches APRS-IS traffic around a location, with each station’s distance and bearing.

  • beacon.py sends your position through a KISS TNC or APRS-IS, once or on a timer.

Versions

8.x is a rewrite with asyncio support and full packet encoding. Earlier versions were released by Greg Albrecht as aprs.

Testing

Run the tests with uv:

uv run pytest

Source

Github: https://github.com/python-aprs/aprs3

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.

decimaldegrees.py - BSD 3-clause License

base91.py - GPL

Metadata

Release files for aprs3 8.2.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 aprs3 8.2.0
File Size Uploaded Provenance Actions
aprs3-8.2.0.tar.gz 871.8 kB Without provenance Details for aprs3-8.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 898.4 kB

Release files / aprs3-8.2.0.tar.gz

Download URL aprs3-8.2.0.tar.gz
Size 871.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ef652e16a3c0c42d63de0432c60743339b94c1b81e84ee78f15995d6803ecbac
BLAKE2b-256 checksum
How to use checksums
71150fa84183ec432442be9423db19d7ac122a78f938023214498e556dcf92ac
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 / aprs3-8.2.0-py3-none-any.whl

Download URL aprs3-8.2.0-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
daafcaec84ffe6213cb74e77d7a4f484926e6edce6b77cb9a351ecd527a1ec5e
BLAKE2b-256 checksum
How to use checksums
cbb5f177529966d792ea5e6ef0933875aef83cd45e232df0d8ef272ca1c080de
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 aprs3 8.2.0

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