{"action":"created","issue":{"url":"https://api.github.com/repos/pypa/pip/issues/2329","labels_url":"https://api.github.com/repos/pypa/pip/issues/2329/labels{/name}","comments_url":"https://api.github.com/repos/pypa/pip/issues/2329/comments","events_url":"https://api.github.com/repos/pypa/pip/issues/2329/events","html_url":"https://github.com/pypa/pip/pull/2329","id":53450206,"number":2329,"title":"Add support for command plugins","user":{"login":"msabramo","id":305268,"avatar_url":"https://avatars.githubusercontent.com/u/305268?v=3","gravatar_id":"","url":"https://api.github.com/users/msabramo","html_url":"https://github.com/msabramo","followers_url":"https://api.github.com/users/msabramo/followers","following_url":"https://api.github.com/users/msabramo/following{/other_user}","gists_url":"https://api.github.com/users/msabramo/gists{/gist_id}","starred_url":"https://api.github.com/users/msabramo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msabramo/subscriptions","organizations_url":"https://api.github.com/users/msabramo/orgs","repos_url":"https://api.github.com/users/msabramo/repos","events_url":"https://api.github.com/users/msabramo/events{/privacy}","received_events_url":"https://api.github.com/users/msabramo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-01-05T21:28:56Z","updated_at":"2015-02-07T00:29:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pypa/pip/pulls/2329","html_url":"https://github.com/pypa/pip/pull/2329","diff_url":"https://github.com/pypa/pip/pull/2329.diff","patch_url":"https://github.com/pypa/pip/pull/2329.patch"},"body":"This introduces a new concept to pip called **\"command plugins\"**. This allows a user to implement new features but do them **outside pip** itself. This means that people can do interesting experimental and/or custom features and implement these features **outside of pip** so that it doesn't clutter up the core code of pip and it doesn't require the time of pip maintainers to review it.\r\n\r\nThis might also be an alternative to simply ripping out features of pip that maybe aren't used a ton and are deemed not worth the effort to maintain them (e.g.: `pip [un]zip`, `pip bundle`, etc.). Perhaps even `pip wheel` could be made into a plugin (although I feel that it is probably used much more than the previously mentioned commands, but maybe since `pip wheel` requires the `wheel` package anyway, maybe it makes sense to just have the `wheel` package implement a pip plugin?). Such features could be removed from pip itself, but put into a separate plugin package and maintained by a 3rd party, so that they are not a time burden on PyPA developers.\r\n\r\nTo create a plugin command, simply:\r\n\r\n- Create a third-party Python distribution. It does not have to be on PyPI. It just needs to be installable.\r\n- Create a class that subclasses the `pip.basecommand.Command` class ([example](https://github.com/msabramo/pipdeptree/blob/pip_plugin/pipdeptree.py#L209)).\r\n- Register your new class with the new `pip.command.v1` entry point in the `setup.py` of your distribution ([example](https://github.com/msabramo/pipdeptree/blob/pip_plugin/setup.py#L24)).\r\n\r\nAn example plugin is available at https://github.com/msabramo/pipdeptree/tree/pip_plugin -- in this branch I've forked an [already existing `pipdeptree` project](https://github.com/naiquevin/pipdeptree) that implements a separate `pipdeptree` command -- in my fork I've put in the necessary bits so that `pipdeptree` is a pip plugin.\r\n\r\nShowing how it works...\r\n\r\n```\r\n[marca@marca-mac2 ~WORKON_HOME]$ mktmpenv\r\nNew python executable in tmp-4adc64ecf8c6ac9e/bin/python\r\nPlease make sure you remove any previous custom paths from your /Users/marca/.pydistutils.cfg file.\r\nInstalling setuptools, pip...done.\r\nThis is a temporary environment. It will be deleted when you run 'deactivate'.\r\n\r\n[marca@marca-mac2 ~VIRTUAL_ENV]$ pip install https://github.com/msabramo/pip/archive/command_plugins.zip\r\n...\r\nSuccessfully installed pip-6.1.0.dev0\r\n\r\n# Install the pipdeptree plugin\r\n[marca@marca-mac2 ~VIRTUAL_ENV]$ pip install https://github.com/msabramo/pipdeptree/archive/pip_plugin.zip\r\nCollecting https://github.com/msabramo/pipdeptree/archive/pip_plugin.zip\r\n  Downloading https://github.com/msabramo/pipdeptree/archive/pip_plugin.zip\r\n     - 20kB 85kB/s\r\nRequirement already satisfied (use --upgrade to upgrade): pip>=1.4.1 in ./lib/python2.7/site-packages (from pipdeptree==0.4.2)\r\nInstalling collected packages: pipdeptree\r\n  Running setup.py install for pipdeptree\r\n    Installing pipdeptree script to /Users/marca/python/virtualenvs/tmp-4adc64ecf8c6ac9e/bin\r\nSuccessfully installed pipdeptree-0.4.2\r\n\r\n[marca@marca-mac2 ~VIRTUAL_ENV]$ pip\r\n\r\nUsage:\r\n  pip <command> [options]\r\n\r\nCommands:\r\n  ...\r\n  deptree                     Display a dependency tree of the installed python packages\r\n\r\n[marca@marca-mac2 ~VIRTUAL_ENV]$ pip deptree --help\r\n\r\nUsage:\r\n  pip deptree [options]\r\n\r\nDeptree Options:\r\n  -f, --freeze                Print names so as to write freeze files\r\n  -a, --all                   list all deps at top level\r\n  -l, --local-only            If in a virtualenv that has global access donot show globally installed packages\r\n  -w, --nowarn                Inhibit warnings about possibly confusing packages\r\n...\r\n\r\n# Just installing a few packages so that the output of `pip deptree` is more interesting...\r\n[marca@marca-mac2 ~VIRTUAL_ENV]$ pip install flask ipython\r\n...\r\n\r\n[marca@marca-mac2 ~VIRTUAL_ENV]$ pip deptree\r\nwsgiref==0.1.2\r\nFlask==0.10.1\r\n  - Werkzeug [required: >=0.7, installed: 0.9.6]\r\n  - Jinja2 [required: >=2.4, installed: 2.7.3]\r\n    - MarkupSafe [installed: 0.23]\r\n  - itsdangerous [required: >=0.21, installed: 0.24]\r\nipython==2.3.1\r\n  - gnureadline [installed: 6.3.3]\r\nwheel==0.24.0\r\n```\r\n\r\nCc: @dstufft, @pfmoore, @naiquevin, @therealprologic\r\n\r\nRefs: https://github.com/naiquevin/pipdeptree/issues/1"},"comment":{"url":"https://api.github.com/repos/pypa/pip/issues/comments/73338816","html_url":"https://github.com/pypa/pip/pull/2329#issuecomment-73338816","issue_url":"https://api.github.com/repos/pypa/pip/issues/2329","id":73338816,"user":{"login":"msabramo","id":305268,"avatar_url":"https://avatars.githubusercontent.com/u/305268?v=3","gravatar_id":"","url":"https://api.github.com/users/msabramo","html_url":"https://github.com/msabramo","followers_url":"https://api.github.com/users/msabramo/followers","following_url":"https://api.github.com/users/msabramo/following{/other_user}","gists_url":"https://api.github.com/users/msabramo/gists{/gist_id}","starred_url":"https://api.github.com/users/msabramo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msabramo/subscriptions","organizations_url":"https://api.github.com/users/msabramo/orgs","repos_url":"https://api.github.com/users/msabramo/repos","events_url":"https://api.github.com/users/msabramo/events{/privacy}","received_events_url":"https://api.github.com/users/msabramo/received_events","type":"User","site_admin":false},"created_at":"2015-02-07T00:29:19Z","updated_at":"2015-02-07T00:29:19Z","body":"Just pushed an update just to fix PEP 8.\r\n\r\nHas anyone tried playing with click yet? I didn't see a branch for it, but  maybe someone is playing with it locally?"}}