-
-
Notifications
You must be signed in to change notification settings - Fork 601
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
Add a plugin system #8272
base: develop
Are you sure you want to change the base?
Add a plugin system #8272
Conversation
…viders, metadata, clients, etc out into namespaced plugin packages Signed-off-by: miigotu <[email protected]>
Important Auto Review SkippedDraft detected. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
4a008fa
to
4a17a8c
Compare
This is so we can get rid of the wonky loading of clients, notifiers and providers and split those into separate packages. This allows an end user to not have to load 50 providers they aren't using into memory for example.
This old way is so bad, and results in memory issues that are unnecessary https://github.com/SickChill/sickchill/blob/master/sickchill/oldbeard/providers/__init__.py#L154
TODO:
create abstract skeleton, and a base plugin that all plugins must subclass. Abstract and base should have descriptions and types and validators for all settings as well as a group of tests we can iterate to ensure settings are correct.
create a base plugin, with standard methods that should work for most plugins. Plugins will override whatever methods necessary to make them work, usually at least the send method, and possibly the method that sets up the data that is received so it is structured in a way the send method understands. More data will be sent from sickchill to the extension methods than is necessary, so it can be filtered out better and structured to fit all plugins.
create an example plugin package that subclasses the base plugin and shows how simple the procedure to create a plugin will be.
create settings reader that is universal for plugins
ensure data integrity and private data security
plugins settings will be in this form:
and will not inherit old settings, merge old settings unless they are internal plugins that are rewritten from the old packages. Plugins will not have access to the full settings inside SC, to ensure third party plugins cannot snoop your private information. First party plugins will be rewritten and settings merged to show how it is done. First party plugins will then be moved to individual packages under the sickchill namespace in pypi. I haven't decided if they will be moved to their own individual repositories on GitHub or stay as submodules in sickchill as a monorepo.
assert in sickchill.extensions.manager:discover that plugin is_subclass of the base class to ensure they adhere to practices and prevent data from being accessed other than what we provide.
determine if all packages must be signed by the sickchill organization or if third party packages will be allowed without organization approval. Some data security NEEDS to be ensured, or some method of establishing trust must be implemented. Will decide as progress is made.
load required settings and their descriptions for each plugin from the plugin itself, and generate a form to set the settings for the plugin, possibly with custom hints given by the plugin settings. Plugin base will provide default form structuring for traditional types, and determine the type of value needed based on type hints and helper methods. This is drastically going to reduce the amount of code to create a plugin because the html and server methods will be magically generated by the plugin base! The simplest plugins (most of them) will just have to define what variables/settings it needs and a send method!
checkbox interface to list available plugins from pypi, install them from pypi in batch form, and enable/disable/uninstall them.
remove old configuration pages for these plugins, and change all code to USE the plugins rather than the old static implementations.