• GitHub
  • Documentation
  • Discord
  • Donate
search
  • chevron_right Threads
  • label Roadmap

Plugin system update

rafalp
Nov. 17, 2023
chat_bubble_outline 6
  • link
    rafalp
    Project Lead 1979 posts
    Nov. 17, 2023, 10:56 p.m. Nov. 17, 2023, 10:56 p.m.
    link

    Misago implements a plugin system, but while working on Misago v4 I've developed new one that's superior to current one. I would like to bring those improvements back to current Misago version:

    • Plugins are kept within plugins directory.
    • Each plugin has top-level directory that contains its requirements files (either pyproject.toml or requirements.txt are supported), its Python package with misago_plugin.py manifest file and, in future, client package that contains plugins for use in JavaScript application.
    • Plugins have misago_plugin.py manifest file which enables plugin authors to provide information about plugin that can be used by Misago on list of installed plugins in admin panel.
    • Plugins use action and filter extension hooks to extend or replace standard logic implemented by Misago.
    • Some of Misago's standard models will have a plugin_data JSON field to let plugins store small bits of in Misago's tables for quick access.

    Plugin directory really simplifies container bootstrap and keeps all plugins in same place.

    Because individual plugins directories are not Python packages but directories that contain Python packages, those plugin dirs can be git clone'd from github as an installation method.

    Each plugin's requirements are taken care of separately. Unwieldy and nightmare to maintain requirements-plugins files are gone.

    Roadmap item: #1524

    thamel likes this.

    favorite 1

  • link
    rafalp
    Project Lead 1979 posts
    Nov. 22, 2023, 9:50 p.m. Nov. 22, 2023, 9:50 p.m.
    link

    New plugin discovery logic has been merged. Misago no longer relies on plugins.txt file to find plugins. Instead there's dedicated plugins directory that is searched for plugins on app's start. Plugin installation and discovery is mentioned in new plugin guide.

    Biggest change from current system is that plugins may be added to Misago directly through git clone, and there's no need to edit any files to activate them.

    Next to do: List of installed plugins in admin panel.

  • link
    rafalp
    Project Lead 1979 posts
    Nov. 26, 2023, 11:09 p.m. Nov. 26, 2023, 11:09 p.m.
    link

    First iteration of plugins list in admin panel:

    Zrzut ekranu 2023-11-26 o 22.36.23.png

    I am not happy with it and I'll try to improve it before merging. 😀

    Zrzut ekranu 2023-11-26 o 22.36.23.png

    PNG, 368.1 KB, uploaded by rafalp on Nov. 26, 2023.

  • link
    rafalp
    Project Lead 1979 posts
    Nov. 28, 2023, 10:14 p.m. Nov. 28, 2023, 10:14 p.m.
    link

    Final version:

    Zrzut ekranu 2023-11-28 o 22.09.26.png

    Zrzut ekranu 2023-11-28 o 22.09.26.png

    PNG, 276.1 KB, uploaded by rafalp on Nov. 28, 2023.

  • link
    rafalp
    Project Lead 1979 posts
    Dec. 6, 2023, 10:14 p.m. Dec. 6, 2023, 10:14 p.m.
    link

    First plugin in admin dashboard:

    Zrzut ekranu 2023-12-6 o 22.09.40.png

    Zrzut ekranu 2023-12-6 o 22.09.40.png

    PNG, 229.0 KB, uploaded by rafalp on Dec. 6, 2023.

    orkan likes this.

    favorite 1

  • link
    rafalp
    Project Lead 1979 posts
    Dec. 10, 2023, 2:35 p.m. Dec. 10, 2023, 2:35 p.m.
    link

    I've quickly realized it may be preferable to site owners to be able to install plugins from PyPI, so now you can also create pip-install.txt file in plugins directory with list of plugins you want to install on Docker's creation. This is regular PIP requirements file, so you can even specify plugin versions in it if you want.

    I've created a minimal plugin example and released it on PyPI to illustrate this. And here's pip-install.txt used in dev.

    In future I would like to create a cookie-cutter repo template to let Misago devs quickly start work on custom plugins.


    Implementation of new plugin system is done. But there's a lot to write the docs for, so its going to be a while before I'll release Misago 0.39 with this code. And after that I'll have to add hooks around the codebase for plugin authors to use. But that's lower priority than new perms/parser and HTMX adaptation.

  • link
    rafalp
    Project Lead 1979 posts
    Dec. 21, 2023, 11:05 p.m. Dec. 21, 2023, 11:05 p.m.
    link

    This feature was merged and released in Misago 0.39.0 beta 1. I'll let this site run on it for a day or few, and then release it.

    ufukayyildiz likes this.

    favorite 1

arrow_upward Go to top
  • This site uses cookies to gather statistical data for use in traffic analysis.
  • GitHub
  • Documentation
  • Discord
  • Donate
  • Terms of service
  • Privacy policy
powered by misago