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

Discover plugins in directory #1668

Merged
merged 14 commits into from
Nov 22, 2023
Merged

Discover plugins in directory #1668

merged 14 commits into from
Nov 22, 2023

Conversation

rafalp
Copy link
Owner

@rafalp rafalp commented Nov 17, 2023

This PR implements new plugin discovery and loading system for #1524

TODO

  • 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
    • Glob plugins manifests from plugins/plugin-dir/plugin_package/misago_plugin.py files
    • Include plugins in INSTALLED_APPS
    • Include plugins in Python path
  • Tests
  • Docs

@rafalp rafalp added area: backend This issue involves Python, Django or dependency (eg. database) enhancement Improvement to existing feature or dev experience area: tooling This issue involves Docker or Bash script future architecture feature: extensions Extension points for 3rd party plugins and customizations labels Nov 17, 2023
@rafalp rafalp added this to the 0.39 milestone Nov 17, 2023
@rafalp rafalp self-assigned this Nov 17, 2023
@rafalp rafalp force-pushed the fix-1524-plugin-system-redo branch from 579c94a to 1d31b84 Compare November 17, 2023 20:35
@rafalp
Copy link
Owner Author

rafalp commented Nov 17, 2023

I've committed first work on this: new plugin dependency installation.

  1. Check if $MISAGO_PLUGINS dir exists
  2. If dir exists, glob for $MISAGO_PLUGINS/*/*/misago_plugin.py
  3. For each path with file like that, install .[dev] requirements from $MISAGO_PLUGINS/*/pyproject.toml.
  4. If pyproject.toml doesn't exist, try installing $MISAGO_PLUGINS/*/requirements.txt.
  5. If pyproject.toml doesn't exist, try installing $MISAGO_PLUGINS/*/requirements-dev.txt.

pyproject.toml and requirements* files are exclusive, but if pyproject.toml doesn't exist, installation from both requirements.txt and requirements-dev.txt is attempted.

In prod (eg. misago-docker) I will skip dev installation.

Its possible to have multiple misago_plugin.py in single plugin and this will result in same requirements installed multiple times, but that won't be officially supported. I just feel its such an edge case that's not worth worrying about.

Next todo: discover plugins from Python, add them to Python path, INSTALLED_APPS and gather their manifests.

@coveralls
Copy link

coveralls commented Nov 17, 2023

Coverage Status

coverage: 98.599% (+0.04%) from 98.56%
when pulling c8580d8 on fix-1524-plugin-system-redo
into 2692e2a on main.

@rafalp rafalp changed the title Plugin system redo Discover plugins in directory Nov 19, 2023
@rafalp rafalp force-pushed the fix-1524-plugin-system-redo branch from b4b3b6e to 9b5d5a2 Compare November 20, 2023 20:36
@rafalp rafalp marked this pull request as draft November 21, 2023 18:05
@rafalp rafalp marked this pull request as ready for review November 22, 2023 20:39
@rafalp rafalp merged commit 38535ec into main Nov 22, 2023
1 check passed
@rafalp rafalp deleted the fix-1524-plugin-system-redo branch November 22, 2023 20:39
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) area: tooling This issue involves Docker or Bash script enhancement Improvement to existing feature or dev experience feature: extensions Extension points for 3rd party plugins and customizations future architecture
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants