Skip to content

Develop against a local plugins_api

By default, madbot installs plugins-api from the GitLab package registry: a fresh clone, a test installation or a server needs nothing else. When you change plugin_api/ itself and want madbot to run your changes, switch to your local checkout.

This page assumes the development setup.

In api/.env:

Terminal window
MADBOT_PLUGIN_API_LOCAL=true

pixi reads it each time it activates an environment and puts your local plugin_api/ ahead of the installed package. The setting applies from the next pixi run or pixi shell, to every pixi environment, until you set it back to false.

To use the other source for a single command, for example to run the tests against the released package:

Terminal window
MADBOT_PLUGIN_API_LOCAL=false pixi run test

The local checkout is the plugin_api folder next to api/. To use another folder, set MADBOT_PLUGIN_API_DIR in api/.env, as a path relative to the root of the repository.

Terminal window
pixi run list-plugins

The released plugins-api package stays installed underneath, so pixi list keeps showing its version. Trust the plugins-api source line printed by pixi run list-plugins, and at the end of every pixi run install-plugins.

pixi resolves the dependencies of the released plugins-api, not those of your checkout. A dependency you add to plugin_api/pyproject.toml is not installed, and its import fails when madbot runs. Until a release of plugins-api declares it, install it in both environments yourself:

Terminal window
pixi run -e default pip install <package>
pixi run -e dev pip install <package>

This leaves pixi.lock untouched, as it should for a dependency that is not released yet. Once the new plugins-api is published and its version range is raised in api/pyproject.toml, pixi installs the dependency itself.

If pixi run list-plugins reports a local source while MADBOT_PLUGIN_API_LOCAL is false, the environment may still hold a copy of plugins-api installed by hand, for example with pip install -e ../plugin_api. It overrides the setting. pixi run install-plugins detects it and asks to run the pixi reinstall plugins-api commands that remove it.