Byte-code and ast programming tools
Project description
Meta
====
.. image:: https://secure.travis-ci.org/srossross/Meta.png?branch=develop
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:
.. code-block:: 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::
.. code-block:: bash
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
=======
.. code-block:: bash
python -m unittest discover meta
test
Versioning
==========
From the version 1.0.0, Meta follows `Semantic Versioning <http://semver.org/spec/v1.0.0.html>`_.
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.
====
.. image:: https://secure.travis-ci.org/srossross/Meta.png?branch=develop
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:
.. code-block:: 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::
.. code-block:: bash
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
=======
.. code-block:: bash
python -m unittest discover meta
test
Versioning
==========
From the version 1.0.0, Meta follows `Semantic Versioning <http://semver.org/spec/v1.0.0.html>`_.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
meta-1.0.0.tar.gz
(49.6 kB
view details)
File details
Details for the file meta-1.0.0.tar.gz
.
File metadata
- Download URL: meta-1.0.0.tar.gz
- Upload date:
- Size: 49.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/20.7.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 182c811d838c2e362c4d3b7aa40baf6325410d1c1c3ef077f12759cd2cdef8c6 |
|
MD5 | 6be600a46a553b2834cee368f0f1a028 |
|
BLAKE2b-256 | fc50508ba6e3683ec8341d9243a793ec942ba53ed10c83361e2eb0b0443d0654 |