-
Notifications
You must be signed in to change notification settings - Fork 24
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
Extendable entrypoint plugins #145
Closed
abkfenris
wants to merge
12
commits into
xpublish-community:main
from
abkfenris:entry-point-plugins-nested
Closed
Extendable entrypoint plugins #145
abkfenris
wants to merge
12
commits into
xpublish-community:main
from
abkfenris:entry-point-plugins-nested
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Builds on top of @benbovy 's work in building router factories in xpublish-community#89 to build a plugin system. The plugin system uses entry points, which are most commonly used for console or GUI scripts. The entry_point group is `xpublish.plugin` Right now plugins can provide dataset specific and general (app) routes, with default prefixes and tags for both. Xpublish will by default load plugins via the entry point. Additionally, plugins can also be loaded directly via the init, as well as being disabled, or configured. The existing dataset router pattern also still works, so that folks aren't forced into using plugins Entry point reference: - https://setuptools.pypa.io/en/latest/userguide/entry_point.html - https://packaging.python.org/en/latest/specifications/entry-points/ - https://amir.rachum.com/amp/blog/2017/07/28/python-entry-points.html
# Conflicts: # .github/workflows/main.yaml # .pre-commit-config.yaml # setup.py
for more information, see https://pre-commit.ci
Another variation on xpublish-community#140 with a few of the ideas from the discussion there and xpublish-community#139. Plugin routers are now nested under a parent `Plugin` class which now acts as a way to combine multiple related pieces of functionality together (say db management routes and a CLI). This allows new plugin functionality to be added in other plugins or Xpublish related libraries without requiring the parent `Plugin` class to define everything. Plugins are loaded from the `xpublish.plugin` entrypoint group. Plugins can be manually configured via the `plugins` argument to `xpublish.Rest`. The specifics of plugin loading can be changed by overriding the `.setup_plugins()` method. Some other `xpublish.Rest` functionality has been refactored out into separate methods to allow easier overriding for instance making a `SingleDatasetRest` class that will allow simplifying `xpublish.Rest`. The `ds.rest` accessor has been move out into it's own file.
Closed
Replacing with #146 which uses Pluggy rather than defining our own plugin management |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Another variation on #140 with a few of the ideas from the discussion there and #139.
Plugin routers are now nested under a parent
Plugin
class which now acts as a way to combine multiple related pieces of functionality together (say db management routes and a CLI). This allows new plugin functionality to be added in other plugins or Xpublish related libraries without requiring the parentPlugin
class to define everything.Plugins are loaded from the
xpublish.plugin
entrypoint group. Plugins can be manually configured via theplugins
argument toxpublish.Rest
. The specifics of plugin loading can be changed by overriding the.setup_plugins()
method.Some other
xpublish.Rest
functionality has been refactored out into separate methods to allow easier overriding for instance making aSingleDatasetRest
class that will allow simplifyingxpublish.Rest
.The
ds.rest
accessor has been move out into it's own file.