uncompyle6 turns .pyc bytecode back into Python source across releases from 1.0 through 3.8 and some PyPy builds. It also decompiles code fragments around bytecode offsets.
Overview
uncompyle6 recovers readable Python from compiled bytecode files when originals are missing or only binaries remain. It builds a parse-style tree from instructions so output is structured rather than a flat disassembly listing.
Beyond full modules, the tool can deparse fragments at a given bytecode offset, which debuggers use to show source context in stack traces when only bytecode is available. The project unifies earlier decompiler forks and continues maintenance across long spans of Python magic numbers.
The uncompyle6 command line accepts .pyc or .pyo inputs, and optional syntax verification checks decompiled text against the interpreter that produced the bytecode. Separate git branches and release tarballs target the Python runtime used to launch the decompiler itself.
Coverage is strongest on Python 2.x and around 3.3–3.4 on Python 3, with known limits on control flow and newer opcode changes. It does not handle obfuscated bytecode, Py2EXE bundles without extraction, or Cython and MicroPython outputs.
Key features
- Bytecode to Python source for many versions
- Fragment decompilation at bytecode offsets
- Parse tree based decompilation pipeline
- CLI uncompyle6 command
- Optional --syntax-verify checking
- PyPy and Dropbox 2.5 bytecode support
- Cross-version fork merged codebase
- Debugger-oriented fragment deparsing
Use cases
- Recovering lost .py files from bytecode
- Showing source context in Python debuggers
- Auditing compiled-only Python distributions
- Comparing decompiler output across tool versions