The ChatGPT-powered decompiler for Python, providing superior code analysis capabilities
From pip
pip install pychdpychd compile <directory | file> # you need to specify a directory or a .py fileE.g.,
pychd compile examples/01_example_variables.py # `example/__pycache__/01_example_variables.cpython-310.pyc` will be createdpychd decompile <pyc-file> # you need to specify a .pyc fileE.g.,
pychd decompile example/__pycache__/01_example_variables.cpython-310.pyc # decompiled code will be printedpychd decompile example/__pycache__/01_example_variables.cpython-310.pyc -o example/decompiled/01_example_variables.cpython-310.py # decompiled code will be written to `example/decompiled/01_example_variables.cpython-310.py`You can find examples in example directory.
-
Install rye.
-
Install all dependencies.
rye sync --all-features-
Set
OPENAI_API_KEYenvironment variable. If you're usingdirenv, you can use.envrc.templateas a template. -
Run the compiler/decompiler.
Using scripts:
rye run python -m pychd.main compile examples/01_example_variables.py # compilerye run python -m pychd.main decompile example/__pycache__/01_example_variables.cpython-310.pyc # decompileActivating the virtual environment:
. .venv/bin/activatepython -m pychd.main compile example/python/01_example_variables.py # compilepython -m pychd.main decompile example/python/01_example_variables.pyc # decompile