Registry / communication / pyais
library3.1.0pypypi✓ verified 86d ago

A Python library for decoding and encoding AIS (Automatic Identification System) messages used in maritime navigation. Current version 3.0.0 (released 2024) with ~35% faster performance, requires Python >=3.9. No regular release cadence; version 2.x was stable for years.

pip install pyais
INSTALL
IMPORT
SIG · PYAIS
P
pyais
communicationpythonv3.1.0
Install
1.7s avg
Import
232ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.250s · 18.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.214s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

decode
from pyais import decode
from pyais.decode import decode
decode is a top-level function, not a submodule. Wrong import raises ModuleNotFoundError.
AISSentence
from pyais import AISSentence
from pyais.messages import AISSentence
AISSentence is exported from pyais; accessing submodule path may break or not exist.
Payload
from pyais import Payload
from pyais.payload import Payload
Payload is a top-level export. Direct submodule import may fail.

Decode a single AIS message from an NMEA 0183 sentence.

from pyais import decode # NMEA 0183 AIS message string msg = "!AIVDM,1,1,,A,133m@ogP00PD;88MD5MTDww@2D7k,0*46" decoded = decode(msg) print(decoded) print(decoded.asdict())
Debug
Known issues
breakingv3.0.0 renamed AISSentence.bit_array to AISSentence.bv and Payload.from_bitarray() to Payload.from_vector(), Payload.to_bitarray() to Payload.to_bytes(). Code using old names will break.
fix
Replace .bit_array with .bv, .from_bitarray() with .from_vector(), .to_bitarray() with .to_bytes().
affects: <3.0.0
breakingv3.0.0 removed the bitarray dependency; replaced with custom bit_vector. Imports like 'from bitarray import bitarray' may not work for pyais internals.
fix
Do not rely on bitarray for pyais objects; use pyais's built-in bit vector.
affects: >=3.0.0
deprecatedNonPrintableCharacterException has been deprecated in v3.0.0 and may be removed in future.
fix
Catch generic Exception or use pyais's custom exceptions; avoid relying on NonPrintableCharacterException.
affects: >=3.0.0
gotchadecode() can raise pyais.exceptions.DecodingError if the message is malformed or checksum fails. New users may not handle exceptions.
fix
Wrap decode() in try/except or validate checksum separately using pyais.checksum.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyais.decode'
Importing decode as a submodule instead of top-level function.
fix
Use 'from pyais import decode'.
AttributeError: 'AISSentence' object has no attribute 'bit_array'
Using deprecated attribute from v2.x. In v3.0.0, 'bit_array' was renamed to 'bv'.
fix
Replace 'bit_array' with 'bv'.
TypeError: decode() missing 1 required positional argument: 'sentence'
Calling decode on a list or forgetting to pass the sentence string.
fix
Ensure you pass a single NMEA sentence string to decode().
Upgrade
Version history
3.1.0latest on PyPI · released Jun 6, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
22
OpenAI (training)
1
Resources
pyais — pip install pyais · libregistry