skillfed

xdis

Python cross-version byte-code disassembler and marshal routines

xdis v6.3.0 662.0K downloads/30d#5,441 on PyPI371
Copyleft license GPL-2.0 Active released

What it is and what it does

xdis is a cross-version Python bytecode disassembler and manipulation library. The standard Python dis module only works on bytecode from the same Python version you are running; xdis removes that constraint, allowing you to inspect, analyze, and disassemble bytecode from any Python version on any other Python version. It can marshal-load bytecode, translate between Python version numbers and magic values, unpack and repack code objects, and provide advanced disassembly output in multiple formats.

The package is useful for reverse-engineering, bytecode analysis, writing cross-version assemblers or optimizers, and understanding how Python compiles code across different language versions. It has no runtime dependencies and is available as pure-Python wheels for most Python versions, though installation on Python versions before 3.11 requires downloading version-specific distributions from GitHub rather than PyPI.

Use it for:

  • Reverse-engineer or audit Python bytecode from a different Python version than your development environment.
  • Write a bytecode-level optimizer or analyzer that works across multiple Python versions.
  • Translate between Python version numbers and their corresponding bytecode magic values for tooling or documentation.
  • Inspect and modify code objects programmatically, such as rewriting constants or instruction sequences.
  • Build a cross-version Python decompiler or bytecode assembler.
  • Debug or analyze compiled Python code from production systems running a different Python version.

Worth the install?

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

Disassembles Python bytecode from any Python version (1.0 through 3.13) regardless of which Python version you are running, and provides utilities for bytecode manipulation, magic-number translation, and code object introspection.

Yes, if you need to work with Python bytecode from versions other than the one you are running. The package is actively maintained, has no dependencies, and carries low install friction on modern Python. The GPL-2.0 copyleft license is a significant constraint for proprietary or closed-source use; evaluate your distribution model before adopting. For Python 3.11+, installation is straightforward; for older versions, the GitHub-only distribution model adds friction but is workable.

Install

xdis on PyPI

pip

pip install xdis

uv

uv add xdis

poetry

poetry add xdis

Installing xdis

Before you install

Low install friction with pure-Python wheels available for Python 2 through 3.13. Actively maintained with a recent release. For Python 3.11+, standard pip install works; older versions require downloading version-specific wheels or tarballs from GitHub Releases rather than PyPI.

License in practice

Licensed under GPL-2.0 (copyleft). Use in proprietary software requires either distributing source code or obtaining a different license; linking or bundling this library into closed-source projects carries copyleft obligations.

Quickstart

pip install xdis

import xdis.disassemble
import xdis.magics

# Disassemble bytecode from a different Python version
with open('some_bytecode.pyc', 'rb') as f:
    xdis.disassemble.disassemble_file(f)

For Python versions before 3.11, you must download and install the version-specific wheel or tarball from GitHub Releases; standard PyPI pip install only works on Python 3.11+.

Verify before relying

  • Whether the package can actually read and disassemble bytecode from Python 1.0 (the description claims support back to 1.0, but this may be aspirational or historical).
  • Whether the 'extended' and 'extended-format' disassembly modes truly produce expression trees as claimed, or if this is limited to certain Python versions.
  • Performance characteristics when processing large bytecode files or many files in sequence.

Package facts

License GPL-2.0 (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 137 days since the last release
Last repo commit
First released
Downloads 661,989/month — #5,441 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: xdis-6.3.0-py2-none-any.whl; xdis-6.3.0-py310-none-any.whl; xdis-6.3.0-py311-none-any.whl; xdis-6.3.0-py312-none-any.whl; xdis-6.3.0-py313-none-any.whl; xdis-6.3.0-py34-none-any.whl; xdis-6.3.0-py35-none-any.whl; xdis-6.3.0-py36-none-any.whl; xdis-6.3.0-py37-none-any.whl; xdis-6.3.0-py38-none-any.whl; xdis-6.3.0-py39-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: GNU General Public License v2 (GPLv2)Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.4Programming Language :: Python :: 2.5Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.1Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: DebuggersTopic :: Software Development :: Libraries :: Python Modules

Tags

cross-version python bytecode disassemblerpython bytecode analysismarshal load bytecodepython magic number conversionbytecode decompilation toolpython code object inspectionwordcode disassembly
bytecode-analysisreverse-engineeringcross-version-compatibility

More Python Modules packages