Skip to main content

Byte-code and ast programming tools

Project description


A Pure Python module containing a framework to manipulate and analyze python abstract syntax trees 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



From the version 1.0.0, Meta follows Semantic Versioning. The version X.Y.Z indicates:

  • X is the major version (backward-incompatible),
  • Y is the minor version (backward-compatible), and
  • Z is the patch version (backward-compatible bug fix).

Prior to version 1.0.0, custom versioning scheme was used.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for meta, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size meta-1.0.2.tar.gz (49.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page