progval / Limnoria

A robust, full-featured, and user/programmer-friendly Python IRC bot, with many existing plugins.
https://docs.limnoria.net/
Other
621 stars 174 forks source link

Installing plugins with unmet dependencies crashes #1583

Open progval opened 4 months ago

progval commented 4 months ago

The current recommended way to make plugins pip-installable is this snippet:

from supybot.setup import plugin_setup

plugin_setup(
    'YourPlugin',
    install_requires=[
        'requests',
    ],
)

in setup.py

This means that:

  1. setup.py itself depends on Limnoria, so pip will crash if Limnoria is not already installed.
  2. Additionally, supybot.setup.plugin_setup imports the plugin (to get its metadata), which imports the plugin's plugin.py, which is likely to import the dependencies. However, said dependencies are not yet installed because we are still running the setup.

Point 1 could be solved by using pyproject.toml to declare a build-dependency on Limnoria. Point 2 is harder to address. We may need to give up on automatically getting plugin metadata through introspection (ie. remove all/most of supybot.setup.plugin_setup) and recommend authors explicitly fill all the metadata in the plugin's pyproject.toml