Skip to content

Instantly share code, notes, and snippets.

@rfletchr
Last active June 6, 2019 06:26
Show Gist options
  • Save rfletchr/2e45ee3a1cedd43be5f4e21b1112fa71 to your computer and use it in GitHub Desktop.
Save rfletchr/2e45ee3a1cedd43be5f4e21b1112fa71 to your computer and use it in GitHub Desktop.
Decompile a 'compiled' python api.

Setup

Ensure that uncomplye6 and black are installed. use conda, venv or just pip install to user..

pip install --user black uncompyle6

Decompile

cd
mkdir decompiled_sources

# -r : recursively walk the input directory
# -o : output to this directory, default behavior is to output in place
uncompyle6 -ro ~/decompiled_sources /path/to/pyc_files

# Next run a code formatter, the output is already very clean so this is
# not strictly needed but it can improve readability.
black ~/decompiled_sources

TODO

  • run sphynx on the result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment