Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/scientifichackers/plugingen

A plugin generator for pip.
https://github.com/scientifichackers/plugingen

Last synced: 3 days ago
JSON representation

A plugin generator for pip.

Awesome Lists containing this project

README

        

# plugingen

Create `pip` plugins in seconds. 🗲

---

For instance, This is how you would go about creating a plugin for the popular package `pipdeptree`:

```python
# pip_plugin_tree.py
import plugingen

cli = plugingen.create(
code="import pipdeptree\npipdeptree.main()", requirements=["pipdeptree"]
)
```

```python
# setup.py
setup(
...
py_modules=['pip_plugin_tree'],
entry_points={"console_scripts": ["pip-plugin-tree = pip_plugin_tree:cli"]},
)
```

And that's literally it.

For just this, You get a plugin that automatically gets discovered, works across virtualenvs, without any modification to the original package whatsoever.

You even get your own little spot at `$ pip --help`:

```
$ pip --help
...
completion A helper command used for command completion.
help Show help for commands.

3rd Party Commands:
tree
compile
sync

General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
...
```

```
$ pip tree -l
Django==2.1.4
- pytz [required: Any, installed: 2018.7]
pip==19.0.dev0
setuptools==40.6.3
wheel==0.32.3
```

---

(This is a prof of concept for a [fork](https://github.com/devxpy/pip) of `pip` that supports plugins. Follow discussion [here](https://github.com/pypa/pip/issues/3999#issuecomment-447743331).)