{ "info": { "author": "Srinivas Garlapati", "author_email": "gsb@gsb-eng.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "\n[![Build Status](https://travis-ci.com/gsb-eng/bytecode_tools.svg?branch=master)](https://travis-ci.com/gsb-eng/bytecode_tools)\n[![Coverage Status](https://img.shields.io/codecov/c/github/gsb-eng/bytecode_tools/master.svg)](https://codecov.io/github/gsb-eng/bytecode_tools?branch=master)\n
\n\nBytecode Tools\n===============\n\nBytecode tools are combination of multiple necessary modules to play with Python\nbytecode. Most of the bytecode related modules are version specific and they won't support\nother python versions.\n\nBytecode won't be same across versions, new opcodes will be added or opcodes will be removed or modified, so python standard library modules won't work with other version generated bytecodes.\n\nLet's say `marshal` module, it's purpose is to `serialize` or `deserialize` code objects, they are version specific. Like wise `dis` module, there is a heavy difference in disassembling `bytecode` to `wordcode` AND opcode differences make this version incompatible.\n\nOur goal is to make `bytecode_tools` work with any `Cpython` version, Aim is to build below tools.\n\n|Tool|Purpose|\n|---|---|\n|unmarshal|deserialize the code obejcts.|Completed|\n|pydis|Disassembler for any Cpython version.|completed|\n|pycdecode|Decoder for bytecode chache files (`pyc` files)|Completed|\n|hackdis|Hack the disassembled bytecode|WIP|\n|decompiler|A decompiler for Cpython x.x|Planned|\n\n\n# How to deal with bytecode_tools?\n\nInstall\n=======\n\n1. Clone this repo and `python setup.py install` or use `pip install .`\n\n2. Install directly from PyPi `pip install bytecode-tools`\n\n\nUsage\n======\n\npydis\n=====\n\nWhat is pydis?\n=========\n\n`pydis` is a python disassembler, it can be a drop in replacement for cpython's\n`Lib/dis.py`.\n\nPydis supports all the cpython versions above 2.5, every verion above 2.5\nsupports other versions. This means, pydis decodes 2.6 bytes code in 3.6 and\nvice versa.\n\nWhy pydis?\n==========\n\nPython's `dis` moduel is super helpful for looking inside code objects, but it\nwon't support other python versions. If the code object is created through\n`python 3.5` and try to disassemble with `python3.6`, it won't work.\n\nEach python version gets changes to opcodes, there will be ne ones added and few\nare deleted. Unless you recreate the code object with new python version, the\nsame code object can't be interpreted with old versions.\n\n\nDisassemble a statement.\n\n >>> from bytecode_tools import pydis\n >>> pydis.dis(\"a=1\")\n 1 0 LOAD_CONST 0 (1)\n 2 STORE_NAME 0 (a)\n 4 LOAD_CONST 1 (None)\n 6 RETURN_VALUE\n\nDisassble a function object.\n\n >>> def foo():\n print(123)\n a = 1\n b = 2\n c = a + b\n return c\n\n >>> pydis.dis(foo)\n 2 0 LOAD_GLOBAL 0 (print)\n 2 LOAD_CONST 1 (123)\n 4 CALL_FUNCTION 1\n 6 POP_TOP\n\n 3 8 LOAD_CONST 2 (1)\n 10 STORE_FAST 0 (a)\n\n 4 12 LOAD_CONST 3 (2)\n 14 STORE_FAST 1 (b)\n\n 5 16 LOAD_FAST 0 (a)\n 18 LOAD_FAST 1 (b)\n 20 BINARY_ADD\n 22 STORE_FAST 2 (c)\n\n 6 24 LOAD_FAST 2 (c)\n 26 RETURN_VALUE\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gsb-eng/bytecode_tools", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "bytecode-tools", "package_url": "https://pypi.org/project/bytecode-tools/", "platform": "", "project_url": "https://pypi.org/project/bytecode-tools/", "project_urls": { "Homepage": "https://github.com/gsb-eng/bytecode_tools" }, "release_url": "https://pypi.org/project/bytecode-tools/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "Python bytecode tools", "version": "0.0.2" }, "last_serial": 5109073, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4d61fd7ec9c632ceb4d2d786307dbe80", "sha256": "6de54db60b99aa1ca0356e73cd32fd1de5e481e8129e519d8b12f4e75791aa26" }, "downloads": -1, "filename": "bytecode_tools-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4d61fd7ec9c632ceb4d2d786307dbe80", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 31101, "upload_time": "2019-02-10T10:06:04", "url": "https://files.pythonhosted.org/packages/e6/86/e4ca2509e9f2d1270a6f08202750595916b2da7561762beee5d1123e53c2/bytecode_tools-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d2bfd43c89beb280c8f3e63de98f2828", "sha256": "1a3e830565d1ba7ab55d821aae1d394bfab72283d84f2c176611a4e9fd7d8a65" }, "downloads": -1, "filename": "bytecode_tools-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d2bfd43c89beb280c8f3e63de98f2828", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30387, "upload_time": "2019-02-10T10:06:07", "url": "https://files.pythonhosted.org/packages/96/35/c8bbfcb98cb49c6fa13e07353e1175329214aeff1127391e8fbe12dfb378/bytecode_tools-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "073388805914558f9eba92cb245deb42", "sha256": "a58045a7290396c46a21d620d26198530d58814b0341669b54d8cf641644229a" }, "downloads": -1, "filename": "bytecode_tools-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "073388805914558f9eba92cb245deb42", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 48756, "upload_time": "2019-04-07T06:02:50", "url": "https://files.pythonhosted.org/packages/dc/1e/a211b82078564f1f74eae455029f3d2fa959968c3856f57c70d7fbd7f6e3/bytecode_tools-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "87da9a536d5d4e9cb2190b3e707e1265", "sha256": "37f1b5180bdfdc356666ddf6d60c6f58b7a7984f29130eb8e9d830992aca375d" }, "downloads": -1, "filename": "bytecode_tools-0.0.2.tar.gz", "has_sig": false, "md5_digest": "87da9a536d5d4e9cb2190b3e707e1265", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34052, "upload_time": "2019-04-07T06:02:55", "url": "https://files.pythonhosted.org/packages/f9/63/1d316cf429088799672b4a2ceb55454a1eb2fe267283af4d91db3c06c8a9/bytecode_tools-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "073388805914558f9eba92cb245deb42", "sha256": "a58045a7290396c46a21d620d26198530d58814b0341669b54d8cf641644229a" }, "downloads": -1, "filename": "bytecode_tools-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "073388805914558f9eba92cb245deb42", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 48756, "upload_time": "2019-04-07T06:02:50", "url": "https://files.pythonhosted.org/packages/dc/1e/a211b82078564f1f74eae455029f3d2fa959968c3856f57c70d7fbd7f6e3/bytecode_tools-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "87da9a536d5d4e9cb2190b3e707e1265", "sha256": "37f1b5180bdfdc356666ddf6d60c6f58b7a7984f29130eb8e9d830992aca375d" }, "downloads": -1, "filename": "bytecode_tools-0.0.2.tar.gz", "has_sig": false, "md5_digest": "87da9a536d5d4e9cb2190b3e707e1265", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34052, "upload_time": "2019-04-07T06:02:55", "url": "https://files.pythonhosted.org/packages/f9/63/1d316cf429088799672b4a2ceb55454a1eb2fe267283af4d91db3c06c8a9/bytecode_tools-0.0.2.tar.gz" } ] }