Registry / serialization / hexrec

hexrec

JSON →
library0.5.1pypypi✓ verified 82d ago

hexrec is a Python library designed to handle hexadecimal record files, such as Intel HEX and Motorola S-records. It provides tools for parsing, creating, and manipulating these records and converting between raw data blocks and record formats. The current version is 0.5.1, and it maintains an active release cadence with periodic updates to support newer Python versions and improve features.

pip install hexrec
INSTALL
IMPORT
SIG · HEXREC
H
hexrec
serializationpythonv0.5.1
Install
2.0s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.1 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20.3MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.0s · import 0.000s · 21MB
18MB installed
● package 18MB
Code
Verified usage

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

IhexFile
from hexrec import IhexFile
from hexrec.records import IntelHexRecord
SrecFile
from hexrec import SrecFile
load
from hexrec import load

This quickstart demonstrates how to create a data Block, convert it into a list of Intel HEX records, and parse a single Intel HEX record line back into a `IntelHexRecord` object using `hexrec.blocks` and `hexrec.records`.

from hexrec.blocks import Block from hexrec.records import IntelHexRecord # Create a Block instance with an address and data data = b'\x00\x01\x02\x03\x04\x05\x06\x07' block = Block(address=0x1000, data=data) print(f"Created Block: Address=0x{block.address:04X}, Data={block.data.hex()}") # Convert the Block to IntelHexRecord instances records = block.to_records(record_type=IntelHexRecord) print("Generated Intel HEX Records:") for record in records: print(record.to_line()) # Example of parsing an Intel HEX record line line = ':10100000000102030405060708090A0B0C0D0E0F00' parsed_record = IntelHexRecord.from_line(line) print(f"\nParsed Record: Address=0x{parsed_record.address:04X}, Data={parsed_record.data.hex()}")
hexrec --version
Debug
Known issues
breakingPython 3.8 support was dropped in hexrec v0.5.0. The minimum required Python version is now 3.9.
fix
Upgrade your Python environment to 3.9 or newer, or pin hexrec to a version <0.5.0 if Python 3.8 is required (e.g., `pip install 'hexrec<0.5.0'`).
affects: >=0.5.0
breakingThe `Record` base class was removed in hexrec v0.3.0. Users subclassing `Record` should now use `BaseRecord`.
fix
Change `from hexrec.records import Record` to `from hexrec.records import BaseRecord` and update your class inheritance if you were directly subclassing `Record`.
affects: >=0.3.0
breakingThe `max_data_len` attribute on record classes was renamed to `max_data_length` in hexrec v0.3.0.
fix
Update all references from `.max_data_len` to `.max_data_length` when accessing the maximum data length for record types.
affects: >=0.3.0
breakingThe `hexrec.base` module was renamed to `hexrec.blocks` in hexrec v0.2.0.
fix
Update all imports from `from hexrec.base import ...` to `from hexrec.blocks import ...`.
affects: >=0.2.0
Upgrade
Version history
0.5.1latest on PyPI · released Jul 25, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
14
Resources
hexrec — pip install hexrec · libregistry