Python bytecode decompiler for Python 1.0 through 3.15 (Python port of depyo.js)
Project description
depyo
Python bytecode decompiler for Python 1.0 through 3.15.
This is the Python port of depyo.js. The JavaScript version is the canonical implementation and is ~4–5× faster; this port exists so you can hack on decompilation logic in Python without a Node runtime.
Status
- Fixture parity with JS baseline: 1183 / 1216 byte-identical (97.3%) across the full fixture suite (Python 1.0–3.15).
- Port-only bugs: 0. The 33 remaining diverging fixtures fail identically on the JS side — they're shared bug-for-bug parity, not port defects.
- Bytecode coverage: Python 1.0 through 3.15.
Install
pip install depyo
Or from source:
pip install -e .
Usage
depyo my_script.pyc
# → writes my_script.py next to the input
All JS CLI flags are supported (--asm, --debug, --raw, --dump, --stats, --strict, --py-version, --basedir, --out, --skip-source-gen, --skip-path, --marshal, --marshal-scan, --file-ext). Run depyo --help for the full list.
Speed
Measured across 1216 .pyc fixtures, 10 passes each:
| Runtime | ms/file | pyc/s | Relative |
|---|---|---|---|
| Node.js (V8) — depyo.js | 0.47 | 2143 | 1.0× |
| CPython 3.12 | 2.48 | 402 | 5.3× slower |
| PyPy 3.10 | 3.87 | 259 | 8.3× slower |
This port is ~4–5× slower than the JS original. Honest disclosure: if you need throughput, use the JS version. If you want to read and modify decompilation logic in idiomatic Python, use this one.
PyPy does not help — it's actually 35% slower than CPython on this workload. The fixtures are short-lived (fresh PycReader/PycDecompiler per file), so the JIT never warms up; hot paths are also heavy on hasattr/getattr/isinstance against polymorphic shapes, which PyPy doesn't specialize well.
Scope
Decompiles .pyc / .pyo from Python 1.0 through 3.15, including:
- All control flow (if/elif/else, while, for, try/except/finally, with, match/case)
- Comprehensions (list, set, dict, generator, async)
- Functions, classes, decorators, async def, coroutines
- PEP 695/696 generic type syntax (3.12+)
- PEP 750 template strings (3.14+)
License
MIT — see LICENSE.
Copyright (c) 2011–2026 Sergey Kuznetsov.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file depyo-1.2.1.tar.gz.
File metadata
- Download URL: depyo-1.2.1.tar.gz
- Upload date:
- Size: 176.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ef4c7f067036dc2f5203ad872d3750472fa90079a308d4f85969c0c324a45bc
|
|
| MD5 |
79def1599dfe1468e7b87a65ce252bf5
|
|
| BLAKE2b-256 |
cecc80cc97292b5c20a6f7001595d73c69329f136cc4a32b7d4ce3eb0a240f1d
|
File details
Details for the file depyo-1.2.1-py3-none-any.whl.
File metadata
- Download URL: depyo-1.2.1-py3-none-any.whl
- Upload date:
- Size: 232.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
875e0630e091b047b34defad650a701b36d0f20cd2cc6bfc927b839b3758b541
|
|
| MD5 |
3228f4da51372bba2bcbc51b26b9dc74
|
|
| BLAKE2b-256 |
4019ebd00e0adae1c406b796e8b4870f2dc20dac40e3694c0867a3937527ca6b
|