{ "info": { "author": "Depop", "author_email": "dev@depop.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "pyorphans\n=========\n\n|PyPI Version| |Build Status|\n\n.. |PyPI Version| image:: http://img.shields.io/pypi/v/pyorphans.svg?style=flat\n :target: https://pypi.python.org/pypi/pyorphans/\n :alt: Latest PyPI version\n\n.. |Build Status| image:: https://circleci.com/gh/depop/pyorphans.svg?style=shield&circle-token=772399d6adddb34029f8360892979c06b36c4df8\n :alt: Build Status\n\nFind dirs which appear to be broken python packages, i.e. dirs which\ncontain ``*.py`` files without the necessary ``__init__.py``\n\nSuggested use is to run as a `Pre-commit `_ hook.\n\n\nWhy?\n----\n\nIn your main code it's unlikely to have orphan modules since they are not importable and likely a cause of visible errors.\n\nHowever in your unit tests, particularly if you have a lot of tests, you may find orphans. They go undetected because while developing you maybe pass the full path to the orphan to your test runner, and it works. But when you run the full suite of tests the orphans won't be found and so you have tests which aren't running!\n\nBy running ``pyorphans`` as a pre-commit hook you can catch the orphans and fix them immediately.\n\n\nCLI Usage\n---------\n\n.. code:: bash\n\n pip install pyorphans\n\nThis will install a console script ``pyorphans``.\n\nTo run the checker, just pass it a list of the root packages in your project:\n\n.. code:: bash\n\n pyorphans tests myproject\n\nIt returns output like:\n\n.. code:: bash\n\n\ttests/unit\n\t-> test_important_stuff.py\n\n\ttests/integration/important_stuff\n\ttests/integration/important_stuff/api\n\t-> test_views.py\n\nWe can see here that ``tests/unit`` dir is missing an ``__init__.py`` but contains ``test_important_stuff.py``\n\nAlso ``tests/integration/important_stuff`` and ``tests/integration/important_stuff/api`` dirs are both missing their ``__init__.py`` files. Inside both directories is found a single 'orphan' file, ``tests/integration/important_stuff/api/test_views.py``.\n\nSay you get an output like:\n\n.. code:: bash\n\n\tmyproject/scripts\n\t-> do_something.py\n\nMaybe ``scripts`` is not intended to be a package and ``do_something.py`` is a perfectly good standalone script that runs from the command-line.\n\nIn this case create a ``.pyorphans_ignore`` file in the root of your project (the dir that pyorphans will be run from), containing:\n\n.. code:: bash\n\n\tmyproject/scripts\n\nNow ``myproject/scripts`` (and all its subdirs) will be excluded from the search for orphans.\n\n\nPre-commit Hook\n---------------\n\nWe suggest using `Pre-commit `_.\n\n.. code:: bash\n\n\tpip install pre-commit\n\nPyorphans is configured as a Pre-commit plugin. To apply it to your project, add a ``.pre-commit-config.yaml`` file to the root of your project like so:\n\n.. code:: yaml\n\n\trepos:\n\t - repo: https://github.com/depop/pyorphans\n\t rev: \"0.2.0\"\n\t hooks:\n\t - id: pyorphans\n\t args:\n\t - myproject\n\t - tests\n\nNow every time you commit, Pyorphans will run and ask you to fix any that it finds. Pyorphans runs fast so you'll hardly notice it's there!", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/depop/pyorphans", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "pyorphans", "package_url": "https://pypi.org/project/pyorphans/", "platform": "", "project_url": "https://pypi.org/project/pyorphans/", "project_urls": { "Homepage": "https://github.com/depop/pyorphans" }, "release_url": "https://pypi.org/project/pyorphans/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "Find dirs which appear to be broken python packages, as a pre-commit hook.", "version": "0.2.1" }, "last_serial": 4845104, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "254990eadda1b62ecc0cda954efd1190", "sha256": "a83eb39b820525a66fffb813dbb38e9ac6e7a38112f9559029e66a324e5c64a4" }, "downloads": -1, "filename": "pyorphans-0.1.0.tar.gz", "has_sig": false, "md5_digest": "254990eadda1b62ecc0cda954efd1190", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3122, "upload_time": "2019-02-12T14:07:42", "url": "https://files.pythonhosted.org/packages/04/5a/52a0262153da6437904ea2ad2054d45fe70ae1c33dffa9779a15f6166698/pyorphans-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "53139afa64bf959e4c6e765981951bd4", "sha256": "ebbc4b8b83a14fb329daa4da01a0a0bf8159a8e09c5931191d8bb4e240961be8" }, "downloads": -1, "filename": "pyorphans-0.2.0.tar.gz", "has_sig": false, "md5_digest": "53139afa64bf959e4c6e765981951bd4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4220, "upload_time": "2019-02-12T14:48:51", "url": "https://files.pythonhosted.org/packages/7e/5c/e4e83be8332642c56e385eec3f9f95790de777e4685ac78a48f4dc532ddd/pyorphans-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "32ee2836cd2047b1e9519a72fb24286a", "sha256": "d1fd0be70ba6421ac37fec90bbbab02ae02290d412751abd6d908d97642c489c" }, "downloads": -1, "filename": "pyorphans-0.2.1.tar.gz", "has_sig": false, "md5_digest": "32ee2836cd2047b1e9519a72fb24286a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4229, "upload_time": "2019-02-20T11:56:31", "url": "https://files.pythonhosted.org/packages/6c/54/23a88ba640427fd8778687d29f1c1dcf1db8b1e4d68aea58302097f27a18/pyorphans-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "32ee2836cd2047b1e9519a72fb24286a", "sha256": "d1fd0be70ba6421ac37fec90bbbab02ae02290d412751abd6d908d97642c489c" }, "downloads": -1, "filename": "pyorphans-0.2.1.tar.gz", "has_sig": false, "md5_digest": "32ee2836cd2047b1e9519a72fb24286a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4229, "upload_time": "2019-02-20T11:56:31", "url": "https://files.pythonhosted.org/packages/6c/54/23a88ba640427fd8778687d29f1c1dcf1db8b1e4d68aea58302097f27a18/pyorphans-0.2.1.tar.gz" } ] }