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

Extendable entrypoint plugins #145

Closed

Conversation

abkfenris
Copy link
Member

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 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.

benbovy and others added 11 commits August 6, 2021 23:09
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
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.
@abkfenris abkfenris mentioned this pull request Jan 8, 2023
@abkfenris
Copy link
Member Author

Replacing with #146 which uses Pluggy rather than defining our own plugin management

@abkfenris abkfenris closed this Jan 15, 2023
@abkfenris abkfenris mentioned this pull request Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants