Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin system rewrite #1524

Closed
33 tasks done
rafalp opened this issue Mar 28, 2023 · 0 comments · Fixed by #1703
Closed
33 tasks done

Plugin system rewrite #1524

rafalp opened this issue Mar 28, 2023 · 0 comments · Fixed by #1703
Assignees
Labels
area: backend This issue involves Python, Django or dependency (eg. database) critical feature: extensions Extension points for 3rd party plugins and customizations future architecture
Milestone

Comments

@rafalp
Copy link
Owner

rafalp commented Mar 28, 2023

This is a rewrite of plugin system inspired largely by my experience from writing a new plugin system for abandoned v4 effort.

Replace plugin list by plugin discovery in plugins directory

Instead of plugins.txt file that users will have to maintain, plugins could be discovered and loaded from dedicated plugins directory. This will simplify installation by users and logic for installing their dependencies on container's build time.

Implement proper action and filter hook types for plugins to use

Misago should implement custom action and filter hooks:

  • action hooks let plugins run extra code when an event happens in code.
  • filter hooks let plugins run extra code around the standard logic implemented by Misago, and in rare cases, replace this logic altogether.

Reason for using custom action hooks instead of Django signals is to provide proper safety net in form of types.

Write developer docs

Misago should have a developer documentation for new plugin system written as quickly as possible. The guide will be human-written, but the hooks reference will be generated from code, due to amount of work needed to maintain and otherwise keep it up to date.

Roadmap

  • Replace plugin list with plugin directory
  • Install requirements
    • Install .[dev] requirements by plugins/plugin-dir/pyproject.toml file
    • Install requirements by plugins/plugin-dir/requirements.txt file
    • Install requirements by plugins/plugin-dir/requirements-dev.txt file
  • Include plugins
    • Include plugins in Python path
    • Include plugins in INSTALLED_APPS
    • Include plugins urls in urlpatterns
  • Display plugins list in admin
    • Gather manifests from plugin/misago_plugin.py files
  • Install plugins from pip using pip-install.txt file
    • Include plugins in INSTALLED_APPS
    • Display plugins on plugins list in admin
  • Add plugin_data json field to some models, set GIN index on it
    • Implement PluginDataModel abstract model
  • Implement hooks
    • Filter hook type
    • Action hook type
    • Template plugin outlet tag
    • Template outlet has plugins conditional tag
  • Docs
    • Plugin structure
    • Plugin installation (local)
    • Plugin installation (pip)
    • Plugin tutorial
    • Plugin manifest
    • Plugin hooks
    • Plugin data
    • Template outlets
    • Template overrides
    • Plugin urls
    • List of links to other extension points in Misago (link to custom notifications)
@rafalp rafalp added future architecture area: backend This issue involves Python, Django or dependency (eg. database) labels Mar 28, 2023
@rafalp rafalp added the critical label Jun 2, 2023
@rafalp rafalp self-assigned this Jun 2, 2023
@rafalp rafalp added this to the 0.38 milestone Nov 11, 2023
@rafalp rafalp added the feature: extensions Extension points for 3rd party plugins and customizations label Nov 11, 2023
@rafalp rafalp changed the title Filters-based plugin system Plugin system redo Nov 18, 2023
@rafalp rafalp changed the title Plugin system redo Plugin system rewrite Nov 18, 2023
This was referenced Nov 19, 2023
@rafalp rafalp pinned this issue Dec 13, 2023
@rafalp rafalp unpinned this issue Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: backend This issue involves Python, Django or dependency (eg. database) critical feature: extensions Extension points for 3rd party plugins and customizations future architecture
Projects
Development

Successfully merging a pull request may close this issue.

1 participant