{ "info": { "author": "Feth Arezki", "author_email": "feth >AT< tuttu dot info", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta" ], "description": "Nouvel Ordre\r\n============\r\n\r\nA tool for *reordering import statements* inside Python code blocks.\r\n\r\nThis project lives on github:\r\n\r\n* github html page: http://feth.github.com/nouvelordre/\r\n* github classic page: https://github.com/feth/nouvelordre\r\n* repository::\r\n\r\n $ git clone git://github.com/feth/nouvelordre.git\r\n\r\nIt also lives on pypi:\r\n* http://pypi.python.org/pypi/nouvelordre/\r\n\r\nGetting started\r\n---------------\r\n\r\nCommon usage\r\n~~~~~~~~~~~~\r\n**'reorder'** is an executable script::\r\n\r\n $ nouvelordre.py --infile mymodule.py --outfile rewritten.py\r\n\r\nis equivalent to::\r\n\r\n $ nouvelordre.py < mymodule.py > rewritten.py\r\n\r\nYou may want to rewrite all files in a directory, say '/home/toto/project'::\r\n\r\n $ for file in $(find '/home/toto/project') ; do reorder -i $file -o $file ; done\r\n $ \r\n $ git diff\r\n\r\n**of course, if you run the above, you are using version control so you can check the diff and revert modifications in case of trouble**\r\n\r\nInstallation\r\n------------\r\nThe installation procedure is not very good for the moment but should work.\r\n\r\nFrom source::\r\n\r\n $ python setup.py install\r\n\r\nFrom the internet (Pypi - http://pypi.python.org )::\r\n\r\n $ pip install nouvelordre\r\n\r\nAs a side note, I suggest installing in a *virtualenv* -this means running the following before installing as above, therefore not polluting your system::\r\n\r\n $ virtualenv nouvelordre\r\n $ cd nouvelordre\r\n $ source ./bin/activate\r\n\r\nOptions\r\n~~~~~~~\r\noptions::\r\n\r\n --infile INFILE, -i INFILE a Python source file, defaults to standard input\r\n --outfile OUTFILE, -o OUTFILE output, defaults to standard output\r\n --dump, -d in case of failure, keep processing data in files\r\n --version, -v prints version and exits\r\n\r\nFeatures\r\n--------\r\n* Blocks separated by anything (white line for instance) are considered separately.\r\n* Statements inside a block are reordered\r\n* Imports in one statement are reordered.\r\n Example::\r\n\r\n import sys, os\r\n\r\n becomes::\r\n\r\n import os\r\n import sys\r\n\r\n or::\r\n\r\n from module import b, a as f, c\r\n\r\n becomes::\r\n\r\n from module import a as f, b, c\r\n* Tries and avoid damaging your precious Python work (see below, Disaster avoidance)\r\n\r\nLimitations\r\n-----------\r\n\r\n* This script will only handle first level statements (ie. not indented statements).\r\n* This script will not handle several \"import module\" for the same module in the same block.\r\n* Some files are not compilables by ast.parse() (help appreciated).\r\n\r\nDependances\r\n-----------\r\n\r\nCompulsory\r\n~~~~~~~~~~\r\n\r\n* Python 2.6 at least (for ast)\r\n* Python 2.7 or python-argparse\r\n\r\nRecommended\r\n~~~~~~~~~~~\r\n\r\n* enthought's python-traits - provides type verification and may catch some bugs (absolutely compulsory if you intend to patch this software).\r\n\r\nExit codes\r\n----------\r\n\r\n* 0 if all is well.\r\n* 129 if NotImplementedError (an import on the same line as another instruction, separated by ';').\r\n* 130 if ast.parse was not able to compile the file.\r\n\r\nDisaster avoidance\r\n------------------\r\n\r\nThis software is not perfect and might kill your golden retriever or ruin your diploma but I have tried hard for this never to happen.\r\n\r\n**'reorder'** performs 2 passes. Pass 1 is performed on the original input; pass 2 is performed on the result of pass 1.\r\nIf any error occurred during either pass, the program exits and leaves your files untouched.\r\nIf pass 1 and 2 would give a different result, the program exits and leaves your files untouched. This is not a 100% guarantee, but it ensures the file stays compilable and all optimizations were performed.\r\n\r\nJust because I prefer my program to admit that it failed than to shred your beautiful Python source code.", "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/feth/nouvelordre", "keywords": "python imports,rewriting", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "nouvelordre", "package_url": "https://pypi.org/project/nouvelordre/", "platform": "", "project_url": "https://pypi.org/project/nouvelordre/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/feth/nouvelordre" }, "release_url": "https://pypi.org/project/nouvelordre/0.1/", "requires_dist": [ "Traits (>= 3.4.0)", "argparse (>= 1.1)" ], "requires_python": "UNKNOWN", "summary": "A tool for reordering import statements inside Python code blocks.", "version": "0.1" }, "last_serial": 795565, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "7466cbe71e2c85704fab108b1a5681dd", "sha256": "8a00476554f6b1d2e118d2397727a1363103b97f6cd05813f9544c8747a1953f" }, "downloads": -1, "filename": "nouvelordre-0.1.tar.gz", "has_sig": false, "md5_digest": "7466cbe71e2c85704fab108b1a5681dd", "packagetype": "sdist", "python_version": "source", "requires_python": "UNKNOWN", "size": 18215, "upload_time": "2011-02-01T18:03:10", "url": "https://files.pythonhosted.org/packages/66/66/3cdd2524b05b213ef61c5d9f42575dbaef55e2cf2b2e30fb2c295cdc8bf8/nouvelordre-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7466cbe71e2c85704fab108b1a5681dd", "sha256": "8a00476554f6b1d2e118d2397727a1363103b97f6cd05813f9544c8747a1953f" }, "downloads": -1, "filename": "nouvelordre-0.1.tar.gz", "has_sig": false, "md5_digest": "7466cbe71e2c85704fab108b1a5681dd", "packagetype": "sdist", "python_version": "source", "requires_python": "UNKNOWN", "size": 18215, "upload_time": "2011-02-01T18:03:10", "url": "https://files.pythonhosted.org/packages/66/66/3cdd2524b05b213ef61c5d9f42575dbaef55e2cf2b2e30fb2c295cdc8bf8/nouvelordre-0.1.tar.gz" } ] }