Metadata-Version: 2.4
Name: depyo
Version: 1.2.1
Summary: Python bytecode decompiler for Python 1.0 through 3.15 (Python port of depyo.js)
Author: Sergey Kuznetsov
License: MIT License
        
        Copyright (c) 2011-2026 Sergey Kuznetsov
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/skuznetsov/depyo.py
Project-URL: Repository, https://github.com/skuznetsov/depyo.py
Project-URL: Issues, https://github.com/skuznetsov/depyo.py/issues
Project-URL: JS original, https://github.com/skuznetsov/depyo.js
Keywords: python,pyc,decompiler,bytecode,ast,disassemble,marshal
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Disassemblers
Classifier: Topic :: Software Development :: Interpreters
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: forbiddenfruit>=0.1.4
Dynamic: license-file

# depyo

Python bytecode decompiler for Python 1.0 through 3.15.

This is the **Python port** of [depyo.js](https://github.com/skuznetsov/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

```bash
pip install depyo
```

Or from source:

```bash
pip install -e .
```

## Usage

```bash
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](https://github.com/skuznetsov/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](LICENSE).

Copyright (c) 2011–2026 Sergey Kuznetsov.
