Third party plugin


Third-party plugins are non-program subdirectories, local modules from installations such as pip or easy_install.

The third-party plugin is easy to use, the program can not put the plugin code into the subdirectory, just use pip install to install to the local machine, and then pass the plugin_packages parameter when the PluginManager is initialized.

This means that anyone can write a package and publish it to pypi, and the user writes requirements.txt and installs the dependent plugin, which is called in the initialization, and almost no need to worry about subsequent third-party plugin upgrades.

Local Plugin

It’s a package under the web application, which is part of the web application, and the plugin developer is the user, more see Plugin Structure.

How to develop plugins?

The local plugin only needs the first step, and the third party plugin needs to write, which requires the next few steps.

  1. First create a package, the metadata and register functions should be written in, the core code can also be written in this file, of course, the recommended approach is to separate the module.

  2. The first step is actually the process of writing local plugins. In this step, you need to write, so that local plugins can be (published in pypi, optionally) used by others through pip:

from setuptools import setup
  1. If your plugin contains template directory or static directory, you need to write an additional manifest file

recursive-include flask_pluginkit_demo/templates *
recursive-include flask_pluginkit_demo/static *
  1. Testing, Release

The modules required by the following commands can be installed like this:

$ pip install -U pip twine wheel setuptools

4.1 Use pip install . to install to the local environment and test the plugin functionality.

4.2 If the plugin is as expected, it can be packaged and the command is: python sdist bdist_wheel, more parameters to adjust themselves.

4.3 Before the official release, you can post to, which is the official pypi test site. The package inside will not be used easily. The command is: twine upload --repository-url dist/*

4.4 The test station can look at the interface description and so on whether it meets the requirements of the heart, and publish it to the official station without problems,, the command is: twine upload dist/*

  1. Third-party example