skillfed

hexrec

Library to handle hexadecimal record files

hexrec v0.5.1 223.2K downloads/30d#9,249 on PyPI18
Permissive license BSD-2-Clause AGING released

What it is and what it does

Hexrec is a library for working with hexadecimal record files—the text-based formats (Intel HEX and Motorola S-record) used in embedded systems to exchange binary data destined for microcontroller flash, EEPROM, or other non-volatile memory. It provides high-level functions to load, parse, edit, and save these files, as well as convert between formats, merge multiple files, and manipulate sparse binary data through a bytearray-like interface backed by bytesparse.

The library addresses a real pain point in embedded development: toolchain support for hex formats is often incomplete or buggy, and manual editing of record files is tedious because checksums and record boundaries must be recalculated. Hexrec handles that bookkeeping automatically. It can also be run as a command-line tool for common operations like format conversion, merging, and cropping.

Use it for:

  • Convert a bootloader and application executable from HEX to SREC format for a board factory that accepts only one format.
  • Merge multiple hex files (bootloader, app, config data) into a single file for microcontroller programming.
  • Extract and modify a specific address range in a hex file (e.g., trim an app to fit a bootloader-reserved region).
  • Generate test datasets by programmatically creating hex records with structured binary data at specific memory addresses.
  • Compute and inject a CRC into a hex file at a predetermined address without re-compiling the firmware.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Loads, edits, and saves hexadecimal record files (Intel HEX and Motorola S-record formats) commonly used in embedded systems to represent binary data for non-volatile memory.

Yes. The package solves a genuine embedded-systems problem with low install friction, permissive licensing, and no known vulnerabilities. The aging maintenance status (385 days since release) is a minor concern but not a blocker, given that the repository is not archived and the last commit is recent. Install if you regularly work with hex or SREC files.

Install

hexrec on PyPI

pip

pip install hexrec

uv

uv add hexrec

poetry

poetry add hexrec

Installing hexrec

Before you install

Low install friction with a pure-Python wheel and only three runtime dependencies. The package is aging (385 days since last release) but the repository remains active with a recent commit on 2025-07-25, suggesting maintenance rather than abandonment.

License in practice

BSD-2-Clause is permissive and poses no significant restriction on use, modification, or distribution in most commercial or open-source contexts.

Quickstart

pip install hexrec

from hexrec import convert
convert('data.hex', 'data.srec')

# Or merge multiple files:
from hexrec import merge
merge(['bootloader.hex', 'app.mot', 'config.xtek'], 'merged.srec')

Requires Python 3.9 or later.

Verify before relying

  • Whether the package's sparse memory editing via bytesparse is performant for large binary files
  • Completeness of support for all Intel HEX and Motorola S-record variants in the wild

Package facts

License BSD-2-Clause (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 3 — bytesparse, click, colorama
Maintenance aging — 385 days since the last release
Last repo commit
First released
Downloads 223,231/month — #9,249 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: hexrec-0.5.1-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Scientific/Engineering :: Interface Engine/Protocol TranslatorTopic :: Software DevelopmentTopic :: Software Development :: Embedded SystemsTopic :: Utilities

Tags

hex file conversionintel hex srec parserembedded binary record fileshexadecimal record formathex file merge editmotorola s-record handlerembedded systems hex tools
embedded-systemsbinary-formatscli-tool

More Software Development packages