Skip to main content

flatline

PyPI Python Downloads Docs CI

Python wrapper around the Ghidra decompiler. Provides a stable, pip-installable interface for single-function decompilation with structured output -- no Ghidra installation required.

Named after Dixie Flatline from William Gibson's Neuromancer (1984) -- a dead hacker's ROM construct, a consciousness extracted from hardware. In the same spirit, flatline brings Ghidra's decompiler into library form for extracting meaningful structure from binaries.

Features

  • Single-function decompilation -- pass a memory image, base address, and function entry point; get back structured C output with diagnostics.
  • Multi-ISA -- x86 (32/64), ARM64, RISC-V 64, and MIPS32 are fixture-backed; all other Ghidra-supported architectures are available best-effort.
  • Enriched output -- opt-in pcode IR with use-def edges and a networkx.MultiDiGraph projection for data-flow analysis.
  • Packaged runtime data -- compiled Sleigh assets come from the companion ghidra-sleigh package. No vendored Ghidra tree at runtime.
  • Deterministic -- repeated decompiles of the same input produce structurally equivalent output.

Installation

pip install flatline

Pre-built wheels are published for Linux x86_64/aarch64, Windows x86_64, and macOS x86_64/arm64 (Python 3.13+). If no wheel matches your platform, pip falls back to a source build.

Build from source

Source builds require a C++20 compiler, Ninja, and zlib headers:

Platform Install command
Ubuntu/Debian sudo apt-get install g++ ninja-build zlib1g-dev
Fedora/RHEL sudo dnf install gcc-c++ ninja-build zlib-devel
Arch Linux sudo pacman -S gcc ninja zlib
macOS brew install ninja zlib (Xcode provides the C++ compiler)
Windows Visual Studio with C++ workload; pip install ninja; vcpkg install zlib:x64-windows
python -m venv .venv
source .venv/bin/activate
pip install .

The native C++ extension is built automatically when a compiler is found. The published wheels already include it. Without it the Python API is fully importable, but decompile calls return a configuration_error result. See the installation guide for native bridge build modes and troubleshooting.

Quick start

from flatline import DecompileRequest, decompile_function

result = decompile_function(DecompileRequest(
    memory_image=raw_bytes,
    base_address=0x400000,
    function_address=0x401000,
    language_id="x86:LE:64:default",
    compiler_spec="gcc",
))

print(result.c_code)

Runtime data is auto-discovered from ghidra-sleigh. Pass runtime_data_dir=... only when overriding the default root.

Flatline zero-fills decoder lookahead past the end of memory_image by default (tail_padding=b"\x00"), so exact function slices work without manual caller padding.

Enriched output

Request enriched=True to get the post-simplification pcode IR:

result = decompile_function(DecompileRequest(
    memory_image=raw_bytes,
    base_address=0x400000,
    function_address=0x401000,
    language_id="x86:LE:64:default",
    compiler_spec="gcc",
    enriched=True,
))

pcode = result.enriched.pcode
graph = pcode.to_graph()          # networkx.MultiDiGraph
op = pcode.get_pcode_op(op_id)    # O(1) lookup
vn = pcode.get_varnode(vn_id)     # O(1) lookup

See the API reference for the full enriched-output contract.

Flatline X-Ray

flatline-xray is a shipped interactive pcode viewer for caller-provided memory images:

pip install "flatline[xray]"     # adds optional capstone disassembly
flatline-xray --help

See the X-Ray docs for usage and tutorial.

Development

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

tox                                          # tests + lint
tox -e lint                                  # lint only
tox -e py313,py314 -- -m unit                # unit tests only
tox -e py313,py314 -- -m requires_native     # native-dependent tests

Tox test envs build and install wheels, so the suite exercises the packaged artifact. Release and diagnostic helpers live under tools/ and are excluded from distribution artifacts.

Building the docs locally

pip install -e ".[docs]"
PYTHONPATH=src mkdocs serve        # http://127.0.0.1:8000

Full documentation is at https://patacca.github.io/flatline/.

Changelog

See CHANGELOG.md. Release policy and support tiers are documented in docs/release_notes.md.

Acknowledgments

This project was developed with the support of Quarkslab.

License

Apache-2.0. See LICENSE for the project license and NOTICE for redistribution-time attribution.

Metadata

Release files for flatline 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flatline 0.1.2
File Size Uploaded
flatline-0.1.2.tar.gz 1.6 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for flatline 0.1.2
File
flatline-0.1.2-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
flatline-0.1.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
flatline-0.1.2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details
flatline-0.1.2-cp314-cp314-macosx_11_0_x86_64.whl CPython 3.14 CPython 3.14 macOS 11.0+ x86-64 Details
flatline-0.1.2-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
flatline-0.1.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
flatline-0.1.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
flatline-0.1.2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details
flatline-0.1.2-cp313-cp313-macosx_11_0_x86_64.whl CPython 3.13 CPython 3.13 macOS 11.0+ x86-64 Details
flatline-0.1.2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details

Total release size: 19.4 MB

Release files / flatline-0.1.2.tar.gz

Download URL flatline-0.1.2.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
431249904e7477a9ba1845873bce12da5abc6916fa28c43c30dd873a10e722f3
BLAKE2b-256 checksum
How to use checksums
d796695914edaac0b65f6628001398f10da7f1342ae2b3cc9fceb4f86869031a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / flatline-0.1.2-cp314-cp314-win_amd64.whl

Download URL flatline-0.1.2-cp314-cp314-win_amd64.whl
Size 1.4 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
0a554cdc155d42ae106f9e989a5c2c16e91b707dbb2fdd7f0a066d29c085cd52
BLAKE2b-256 checksum
How to use checksums
63d9ed7b5addeee8b1ad046fcac1ff501d577b676c4bde92ac96228ee3e22262
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / flatline-0.1.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL flatline-0.1.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1384c110970dfbf7609df56914783b489113cb048d027e8f879aa4cd6478eb8b
BLAKE2b-256 checksum
How to use checksums
2cf7cb74dfa88691ece86d68a2c30962c031af74f52b95b3dc3af8c441d38fd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / flatline-0.1.2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL flatline-0.1.2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 2.1 MB
Tags CPython 3.14 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
dfe86c0f05009c40c9e56119d53c8133ff9c7fb2de3b75ce40c04f6c591a7a62
BLAKE2b-256 checksum
How to use checksums
76bc28316fa8b5b6a46122fe9e3862b6480f5c48be732b4c7d05ce296193c6b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / flatline-0.1.2-cp314-cp314-macosx_11_0_x86_64.whl

Download URL flatline-0.1.2-cp314-cp314-macosx_11_0_x86_64.whl
Size 1.6 MB
Tags CPython 3.14 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
9a4035db7db371545a6665279eeace383dadf88405d7efd211e4660980acf916
BLAKE2b-256 checksum
How to use checksums
5ef507fdf4501ed4822b095933b062ad315b57e07c1eb4ca916ca20893eb6c4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / flatline-0.1.2-cp314-cp314-macosx_11_0_arm64.whl

Download URL flatline-0.1.2-cp314-cp314-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ea07e235595f709c8cd3fe2daeebbf762dae76dc4e5ed0ead430e0eb3287b2b3
BLAKE2b-256 checksum
How to use checksums
ce695652754d27a8413faa22c09091d046e5471de95cca292412f813ce4e1cc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / flatline-0.1.2-cp313-cp313-win_amd64.whl

Download URL flatline-0.1.2-cp313-cp313-win_amd64.whl
Size 1.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
158f3289023c472f4dc9eed946f80e404631605529c9ac678b08721e2b127609
BLAKE2b-256 checksum
How to use checksums
ed2d428f4c6d992c6c6893302f2f7b18362fdfc2ffb6b891b144a934b9d97410
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / flatline-0.1.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL flatline-0.1.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f1cb22dcb3c8f8960e3c80d1a381bca66e4a9a86988e1b71f82a68228bea2ff6
BLAKE2b-256 checksum
How to use checksums
9c0227cadaf881dbe1bc99d3cabb0193810073bcb18cfe3908bdbce67f3e0a74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / flatline-0.1.2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL flatline-0.1.2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 2.1 MB
Tags CPython 3.13 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
fb7e5cea1d19f3b75a6f01bcd4eb203150c7547a9d435af1072d82ebccfd95d4
BLAKE2b-256 checksum
How to use checksums
4612ef9d47abe37050e0d5723d99b1ee119b88073b8e6a4c4eeab18e66ca7533
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / flatline-0.1.2-cp313-cp313-macosx_11_0_x86_64.whl

Download URL flatline-0.1.2-cp313-cp313-macosx_11_0_x86_64.whl
Size 1.6 MB
Tags CPython 3.13 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
afa16f8ac3e1df2572e54a0a1708cc570f6d6934d1249f091b01898bcbc208c4
BLAKE2b-256 checksum
How to use checksums
b141bcea6fd53efa8dcf310bb6ff5f64b20713a71b7052dcce1b58e6ec1d8ece
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release files / flatline-0.1.2-cp313-cp313-macosx_11_0_arm64.whl

Download URL flatline-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
403cbfe8bf3861c4bd1baa11cbf64641cbd9a0c5d8fb367bfb76d43d4d54a9a4
BLAKE2b-256 checksum
How to use checksums
d4c302fc64c604cffc93a3d59617805d857866a40195934e3d875e57051a2132
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

11 release files

0.1.1

11 release files

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