{ "info": { "author": "Dan McDougall ", "author_email": "daniel.mcdougall@liftoffsoftware.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: GNU Affero General Public License v3", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "pyminifier\n==========\n\nPyminifier is a Python code minifier, obfuscator, and compressor.\n\n.. note::\n\n * For the latest, complete documentation: http://liftoff.github.io/pyminifier/\n * For the latest code: https://github.com/liftoff/pyminifier\n\nOverview\n--------\nWhen you install pyminifier it should automatically add a 'pyminifier'\nexecutable to your ``$PATH``. This executable has a number of command line\narguments:\n\n.. code-block:: sh\n\n $ pyminifier --help\n Usage: pyminifier [options] \"\"\n\n Options:\n --version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0show program's version number and exit\n -h, --help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0show this help message and exit\n -o , --outfile=\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Save output to the given file.\n -d , --destdir=\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Save output to the given directory. This option is\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0required when handling multiple files. Defaults to\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'./minified' and will be created if not present.\n --nominify\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Don't bother minifying (only used with --pyz).\n --use-tabs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Use tabs for indentation instead of spaces.\n --bzip2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bzip2-compress the result into a self-executing python\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0script. Only works on stand-alone scripts without\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0implicit imports.\n --gzip\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0gzip-compress the result into a self-executing python\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0script. Only works on stand-alone scripts without\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0implicit imports.\n --lzma\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0lzma-compress the result into a self-executing python\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0script. Only works on stand-alone scripts without\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0implicit imports.\n --pyz=.pyz\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0zip-compress the result into a self-executing python\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0script. This will create a new file that includes any\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0necessary implicit (local to the script) modules.\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Will include/process all files given as arguments to\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pyminifier.py on the command line.\n -O, --obfuscate\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Obfuscate all function/method names, variables, and\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0classes. Default is to NOT obfuscate.\n --obfuscate-classes\u00a0\u00a0\u00a0Obfuscate class names.\n --obfuscate-functions\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Obfuscate function and method names.\n --obfuscate-variables\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Obfuscate variable names.\n --obfuscate-import-methods\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Obfuscate globally-imported mouled methods (e.g.\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'Ag=re.compile').\n --obfuscate-builtins\u00a0\u00a0Obfuscate built-ins (i.e. True, False, object,\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Exception, etc).\n --replacement-length=1\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The length of the random names that will be used when\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0obfuscating identifiers.\n --nonlatin\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Use non-latin (unicode) characters in obfuscation\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(Python 3 only). WARNING: This results in some\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SERIOUSLY hard-to-read code.\n --prepend=\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Prepend the text in this file to the top of our\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0output. e.g. A copyright notice.\n\nFor the examples below we'll be minifying, obfuscating, and compressing the\nfollowing totally made-up Python script (saved to ``/tmp/tumult.py``)::\n\n #!/usr/bin/env python\n \"\"\"\n tumult.py - Because everyone needs a little chaos every now and again.\n \"\"\"\n\n try:\n import demiurgic\n except ImportError:\n print(\"Warning: You're not demiurgic. Actually, I think that's normal.\")\n try:\n import mystificate\n except ImportError:\n print(\"Warning: Dark voodoo may be unreliable.\")\n\n # Globals\n ATLAS = False # Nothing holds up the world by default\n\n class Foo(object):\n \"\"\"\n The Foo class is an abstract flabbergaster that when instantiated\n represents a discrete dextrogyratory inversion of a cattywompus\n octothorp.\n \"\"\"\n def __init__(self, *args, **kwargs):\n \"\"\"\n The initialization vector whereby the ineffably obstreperous\n becomes paramount.\n \"\"\"\n # TODO. BTW: What happens if we remove that docstring? :)\n\n def demiurgic_mystificator(self, dactyl):\n \"\"\"\n A vainglorious implementation of bedizenment.\n \"\"\"\n inception = demiurgic.palpitation(dactyl) # Note the imported call\n demarcation = mystificate.dark_voodoo(inception)\n return demarcation\n\n def test(self, whatever):\n \"\"\"\n This test method tests the test by testing your patience.\n \"\"\"\n print(whatever)\n\n if __name__ == \"__main__\":\n print(\"Forming...\")\n f = Foo(\"epicaricacy\", \"perseverate\")\n f.test(\"Codswallop\")\n\nBy default pyminifier will perform basic minification and print the resulting\ncode to stdout:\n\n.. note:: The tumult.py script is 1358 bytes. Remember that.\n\n.. code-block:: sh\n\n #!/usr/bin/env python\n \ufd5b=ImportError\n \u0845=print\n \u3b80=False\n \u6413=object\n try:\n import demiurgic\n except \ufd5b:\n \u0845(\"Warning: You're not demiurgic. Actually, I think that's normal.\")\n try:\n import mystificate\n except \ufd5b:\n \u0845(\"Warning: Dark voodoo may be unreliable.\")\n \ufd69=\u3b80\n class \ufb48(\u6413):\n def __init__(self,*args,**kwargs):\n pass\n def \ud802\ude31(self,dactyl):\n \ufc72=demiurgic.palpitation(dactyl)\n \ua041=mystificate.dark_voodoo(\ufc72)\n return \ua041\n def \ud862\udc05(self,whatever):\n \u0845(whatever)\n if __name__==\"__main__\":\n \u0845(\"Forming...\")\n \ub142=\ufb48(\"epicaricacy\",\"perseverate\")\n \ub142.\ud862\udc05(\"Codswallop\")\n # Created by pyminifier.py (https://github.com/liftoff/pyminifier)\n\nThis reduced the size of tumult.py from 1358 bytes to 640 bytes. Not bad!\n\nMinifying by itself can reduce code size considerably but pyminifier can go\nfurther by obfuscating the code. What that means is that it will replace the\nnames of things like variables and functions to the smallest possible size.\n\nTo see more examples of pyminifier in action (e.g. compression features) see the\n`full documentation `_\n\nSpecial Sauce\n-------------\nSo let's pretend for a moment that your intentions are not pure; that you\ntotally want to mess with the people that look at your minified code. What you\nneed is Python 3 and the ``--nonlatin`` option...\n\n.. code-block:: sh\n\n #!/usr/bin/env python3\n \u0717=ImportError\n \u0721=print\n \u072a=False\n \u067d=object\n try:\n import demiurgic\n except \u0717:\n \u0721(\"Warning: You're not demiurgic. Actually, I think that's normal.\")\n try:\n import mystificate\n except \u0717:\n \u0721(\"Warning: Dark voodoo may be unreliable.\")\n \u072c=\u072a\n class \u0638(\u067d):\n def __init__(self,*args,**kwargs):\n pass\n def \u0637(self,dactyl):\n \u067c=demiurgic.palpitation(dactyl)\n \u2db9=mystificate.dark_voodoo(\u067c)\n return \u2db9\n def \u0718(self,whatever):\n \u0721(whatever)\n if __name__==\"__main__\":\n \u0721(\"Forming...\")\n f=\u0638(\"epicaricacy\",\"perseverate\")\n f.test(\"Codswallop\")\n # Created by pyminifier.py (https://github.com/liftoff/pyminifier)\n\nYes, that code actually works *but only using Python 3*. This is because Python\n3 supports coding in languages that use non-latin character sets.\n\n.. note::\n\n Most text editors/IDEs will have a hard time with code generated using the\n ``--nonlatin`` option because it will be a random mix of left-to-right\n and right-to-left characters. Often the result is some code appearing on\n the left of the screen and some code appearing on the right. This makes it\n *really* hard to figure out things like indentation levels and whatnot!\n\nThere's even more ways to mess with people in the\n`full documentation `_\n", "description_content_type": null, "docs_url": "https://pythonhosted.org/pyminifier/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/liftoff/pyminifier", "keywords": null, "license": "Proprietary", "maintainer": null, "maintainer_email": null, "name": "pyminifier", "package_url": "https://pypi.org/project/pyminifier/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyminifier/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/liftoff/pyminifier" }, "release_url": "https://pypi.org/project/pyminifier/2.1/", "requires_dist": null, "requires_python": null, "summary": "Python code minifier, obfuscator, and compressor", "version": "2.1" }, "last_serial": 1110025, "releases": { "2.0": [ { "comment_text": "", "digests": { "md5": "66448cd2e8ee08918cc3563b1377e5c8", "sha256": "1f865e042dc57adfed6a0578d2d3421a8fff6daca9ce508efe310cda61c2a73f" }, "downloads": -1, "filename": "pyminifier-2.0.tar.gz", "has_sig": false, "md5_digest": "66448cd2e8ee08918cc3563b1377e5c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 46123, "upload_time": "2014-05-25T16:35:57", "url": "https://files.pythonhosted.org/packages/01/d4/545e4a9c4cfcb8e7899726381bdddf812bda6f605421dc45c380d642390b/pyminifier-2.0.tar.gz" } ], "2.1": [ { "comment_text": "", "digests": { "md5": "c1a6b92e69f664005f7adf188c514de7", "sha256": "e192618fe901830e9298825b32828bc9555ae8649e05af37bfab2db328546777" }, "downloads": -1, "filename": "pyminifier-2.1.tar.gz", "has_sig": false, "md5_digest": "c1a6b92e69f664005f7adf188c514de7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47285, "upload_time": "2014-05-31T23:22:55", "url": "https://files.pythonhosted.org/packages/2c/8a/946b0b43e0912c907aba42507073675c2e4a4a836c5b1ce10be6f12575d0/pyminifier-2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c1a6b92e69f664005f7adf188c514de7", "sha256": "e192618fe901830e9298825b32828bc9555ae8649e05af37bfab2db328546777" }, "downloads": -1, "filename": "pyminifier-2.1.tar.gz", "has_sig": false, "md5_digest": "c1a6b92e69f664005f7adf188c514de7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47285, "upload_time": "2014-05-31T23:22:55", "url": "https://files.pythonhosted.org/packages/2c/8a/946b0b43e0912c907aba42507073675c2e4a4a836c5b1ce10be6f12575d0/pyminifier-2.1.tar.gz" } ] }