Skip to content
Python Meta Programming
Find file
#2 Compare This branch is 11 commits ahead, 9 commits behind srossross:develop.
Failed to load latest commit information.
doc DOC: Fix Sphinx build directory in the Makefile. Sep 25, 2012
meta Merge into _update Feb 22, 2013
.travis.yml BUG: added readme.rst to manifest. Jan 5, 2012
README.rst DOC: fixed image Sep 27, 2012
license.rst DOC: updated Jan 5, 2012 DOC: updated Jan 6, 2012



A Pure Python module containing a framework to manipulate and analyze python ast's and bytecode.


This shows how to take python source to a code object and back again from within python:

import meta, ast
source = '''
a = 1
b = 2
c = (a ** b)

mod = ast.parse(source, '<nofile>', 'exec')
code = compile(mod, '<nofile>', 'exec')

mod2 = meta.decompile(code)
source2 = meta.dump_python_source(mod2)

assert source == source2

This shows the depyc script. The script compiles itself, and then the compiled script extracts itself:

DEPYC_FILE=`python -c"import meta.scripts.depyc; print meta.scripts.depyc.__file__"`
depyc $DEPYC_FILE --pyc > depycX.pyc
python -m depycX depycX.pyc --python >


  • Meta is python3 compliant (mostly)


  • The decompliler does not yet support complex list/set/dict - comprehensions


python -m unittest discover meta

Something went wrong with that request. Please try again.