LLM-powered Python bytecode decompiler supporting multiple providers via litellm
Project description
PyChD
LLM-powered Python bytecode decompiler. Uses litellm to support OpenAI, Anthropic, Google, Ollama, and other providers. Handles .pyc files from any Python version via xdis.
Prerequisites
Quick start
just build # build the Docker image
just lint # run linters (ruff, pyrefly)
just test # run tests
just ci # lint + test
just shell # interactive shell inside the container
Install (pip)
pip install pychd
Usage
Compile
pychd compile <directory | file>
just compile example/python/01_example_variables.py
Decompile
pychd decompile <pyc-file> [-m MODEL] [-o OUTPUT]
# Default model (ollama/deepseek-r1)
just decompile example/__pycache__/01_example_variables.cpython-314.pyc
# Specify a model
just decompile example/__pycache__/01_example_variables.cpython-314.pyc gpt-4o
Supported -m values include any model supported by litellm:
| Provider | Example |
|---|---|
| OpenAI | gpt-4o |
| Anthropic | claude-sonnet-4-20250514 |
gemini/gemini-2.0-flash |
|
| Ollama (local) | ollama/deepseek-r1, ollama/llama3 |
Large disassembly is automatically split into token-safe chunks when it exceeds the model's context window.
Validate
Compare original source against decompiled output using AST comparison:
pychd validate <original> <decompiled> [-v]
just validate example/python/ example/decompiled/
Development
All development tasks run inside Docker via just. No local Python installation is required.
just fix # auto-fix lint issues
just test # run pytest
just shell # drop into the container
Examples
Example Python source files are in example/python/. Pre-generated decompiled output is in example/decompiled/.
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 pychd-1.0.0.tar.gz.
File metadata
- Download URL: pychd-1.0.0.tar.gz
- Upload date:
- Size: 74.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fb56dfb17cde0092b8526b310cd845367ca01802763ac2749d799fcbb80fae0
|
|
| MD5 |
f5faea4d376cbcac2bb18f929cf1b72a
|
|
| BLAKE2b-256 |
8452c7b855a17c2b751a90890c9a760d0f64641188366c4511b7a9b7c4b38a20
|
Provenance
The following attestation bundles were made for pychd-1.0.0.tar.gz:
Publisher:
publish.yaml on diohabara/pychd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pychd-1.0.0.tar.gz -
Subject digest:
9fb56dfb17cde0092b8526b310cd845367ca01802763ac2749d799fcbb80fae0 - Sigstore transparency entry: 985013919
- Sigstore integration time:
-
Permalink:
diohabara/pychd@8eb2fa5ab8d2c9d7f8421f00dda219f4f19b5fe8 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/diohabara
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@8eb2fa5ab8d2c9d7f8421f00dda219f4f19b5fe8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pychd-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pychd-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07a9c4e6a8d60f7111863ee17e73d4c6df2a41d026655225506ee7083488f305
|
|
| MD5 |
951fb37126009300cc5f37eed5b200a3
|
|
| BLAKE2b-256 |
f1b8fe6760db0582c6c43dfa8ccc4eb7d1fddf006c716c123dbb397f4921f9bb
|
Provenance
The following attestation bundles were made for pychd-1.0.0-py3-none-any.whl:
Publisher:
publish.yaml on diohabara/pychd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pychd-1.0.0-py3-none-any.whl -
Subject digest:
07a9c4e6a8d60f7111863ee17e73d4c6df2a41d026655225506ee7083488f305 - Sigstore transparency entry: 985013924
- Sigstore integration time:
-
Permalink:
diohabara/pychd@8eb2fa5ab8d2c9d7f8421f00dda219f4f19b5fe8 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/diohabara
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@8eb2fa5ab8d2c9d7f8421f00dda219f4f19b5fe8 -
Trigger Event:
push
-
Statement type: