Skip to main content

Meta

A Pure Python module containing a framework to manipulate and analyze python abstract syntax trees and bytecode.

Example

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 > depycX.py
echo depycX.py

Notes

  • Meta is python3 compliant (mostly)

Bugs

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

Testing

python -m unittest discover meta

test

Versioning

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.

Release files for meta 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meta 1.0.2
File Size Uploaded
meta-1.0.2.tar.gz 49.3 kB Details

Release files / meta-1.0.2.tar.gz

Download URL meta-1.0.2.tar.gz
Size 49.3 kB
Tags Source
SHA-256 checksum
How to use checksums
35bbd24f212c09e04836ef4cac3e3a0e16e24e89e5452c6072a517bf674b0676
BLAKE2b-256 checksum
How to use checksums
784ebf6414dd628664eee7d03831f36fe9ffd43708c36c8bd43ae56ebe7cd69d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/20.10.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.2+

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file

1.0.0

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page