{ "info": { "author": "Gareth Rees", "author_email": "gdr@garethrees.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Programming Language :: Python :: 2", "Topic :: Software Development :: Pre-processors" ], "description": "======\nminipy\n======\na Python 2 minifier\nby Gareth Rees \n\nThis https://github.com/cpbotha/minipy is a fork of the original\nhttps://github.com/gareth-rees/minipy only to fix the broken PiPI\ninstall, see https://github.com/gareth-rees/minipy/issues/52\n\nIntroduction\n------------\n**minipy** is a minifier for Python 2. It rewrites Python 2 source code in a\nway that preserves the meaning of the code while reducing it in\nsize. For example::\n\n $ cat fib.py\n cache = {0: 0, 1: 1, 2: 1, 3: 2}\n def fibonacci(n):\n \"\"\"Return the nth Fibonacci number.\"\"\"\n if n not in cache:\n a = n // 2\n r = n % 2\n m = (r * 2) - 1\n cache[n] = fibonacci(a + 1) ** 2 + m * fibonacci(a + r - 1) ** 2\n return cache[n]\n\n $ minipy --rename --docstrings fib.py\n b={0:0,1:1,2:1,3:2}\n def c(a):\n if a not in b:d=a//2;e=a%2;f=e*2-1;b[a]=c(d+1)**2+f*c(d+e-1)**2\n return b[a]\n\n\nCommand line\n------------\n::\n\n Usage: minipy [options] [-o OUTPUT] FILE\n\n Options:\n --version show program's version number and exit\n -h, --help show this help message and exit\n -o OUTPUT, --output=OUTPUT\n output file (default: stdout)\n -D, --docstrings remove docstrings and other statements with no side\n effects (implies --noselftest)\n -R, --rename aggressively rename non-preserved variables\n -i INDENT, --indent=INDENT\n number of spaces per indentation level\n -p PRESERVE, --preserve=PRESERVE\n preserve words from renaming (separate by commas)\n --nojoinlines put each statement on its own line\n --noselftest skip the self-test\n --debug dump the parse tree\n\n\nThe self-test\n-------------\nGenerating minified source code without accidentally changing the\nmeaning is tricky: see the `list of issues`_ for many awkward cases\nthat had to be fixed. Therefore, in its default operating mode, minipy\nperforms a \u201cself-test\u201d: it takes the minified code, re-parses it, and\nasserts that the parse tree for the minified code is identical to the\nparse tree for the original code. If the self-test passes, then you can\nbe highly confident that minipy has not changed the meaning of your\ncode.\n\nIn order to pass the self-test, minipy must eschew a few changes to the\ncode that result in harmless changes to the parse tree. These changes\nare:\n\n* Replacing ``pass`` with ``0``.\n* Replacing ``-(1)`` with ``-1``.\n\nYou can use the ``--noselftest`` option to enable these changes, but by\ndisabling the self-test you accept a small risk of a bug in minipy\nchanging the meaning of your code.\n\nThe optional transformations ``--rename`` and ``--docstrings`` can\u2019t be\ncombined with the self-test, so these options imply ``--noselftest``.\n\nPlease report_ all self-test failures, attaching the code that causes\nthe failure.\n\n\nRenaming\n--------\nPython\u2019s use of introspection and duck typing means that it is not\npossible to change names in a program without risk of changing the\nmeaning. The ``--rename`` option to minipy therefore makes a \u201cbest attempt\u201d\nto discover names that need to be preserved, but does not guarantee\nanything. Use at your own risk!\n\nThe following names are preserved when renaming:\n\n* Names specified on the command-line via the ``--preserve`` option\n (write ``--preserve=name1,name2,name3`` to preserve more than one name).\n* Built-in names (``abs``, ``all``, ``any``, ``apply``, ...).\n* Any name used as an attribute (``.join``, ``.index``, ``.copy``, ``.sort``, ...).\n* Any name starting and ending with two underscores.\n* Any name exported by a module in a ``from module import *`` statement.\n* Any name in the list assigned to the ``__all__`` global variable.\n\n\nLicense\n-------\nminipy is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 3 of the License, or (at your\noption) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the `GNU\nGeneral Public License`_ for more details.\n\n\n.. _list of issues: https://github.com/gareth-rees/minipy/issues?state=closed\n.. _report: https://github.com/gareth-rees/minipy/issues/new\n.. _GNU General Public License: http://www.gnu.org/copyleft/gpl.html", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cpbotha/minipy", "keywords": null, "license": "GNU General Public License (GPL) Version 3", "maintainer": null, "maintainer_email": null, "name": "minipy-ppf", "package_url": "https://pypi.org/project/minipy-ppf/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/minipy-ppf/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/cpbotha/minipy" }, "release_url": "https://pypi.org/project/minipy-ppf/0.2/", "requires_dist": null, "requires_python": null, "summary": "Minify Python 2 source code - PyPI Fix", "version": "0.2" }, "last_serial": 1094935, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "298fbf2996af20ff6fad5ee29adc2a13", "sha256": "68e9054c630dd4dc197b8e0d3f84c93ce19cfa16e9206f7e3956221796322c80" }, "downloads": -1, "filename": "minipy-ppf-0.2.tar.gz", "has_sig": false, "md5_digest": "298fbf2996af20ff6fad5ee29adc2a13", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15972, "upload_time": "2014-05-16T19:11:07", "url": "https://files.pythonhosted.org/packages/bc/db/e7decf289b709f63497898eef6a38fa56ad0fbb854764f223df0da79984c/minipy-ppf-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "298fbf2996af20ff6fad5ee29adc2a13", "sha256": "68e9054c630dd4dc197b8e0d3f84c93ce19cfa16e9206f7e3956221796322c80" }, "downloads": -1, "filename": "minipy-ppf-0.2.tar.gz", "has_sig": false, "md5_digest": "298fbf2996af20ff6fad5ee29adc2a13", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15972, "upload_time": "2014-05-16T19:11:07", "url": "https://files.pythonhosted.org/packages/bc/db/e7decf289b709f63497898eef6a38fa56ad0fbb854764f223df0da79984c/minipy-ppf-0.2.tar.gz" } ] }