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

Add a plugin system #8272

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft

Add a plugin system #8272

wants to merge 5 commits into from

Conversation

miigotu
Copy link
Contributor

@miigotu miigotu commented Oct 22, 2022

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:

[extensions]
  [[clients]]
    [[[transmission]]]
      server = 192.168.1.1

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.

…viders, metadata, clients, etc out into namespaced plugin packages

Signed-off-by: miigotu <miigotu@gmail.com>
Copy link
Contributor

coderabbitai bot commented Jan 9, 2024

Important

Auto Review Skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

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?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@miigotu miigotu force-pushed the develop branch 2 times, most recently from 4a008fa to 4a17a8c Compare February 17, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant