Flask-PluginKit is a Flask extension for extending web application functionality. It provides an easy way to create plugins for your application. It is possible to create extension points which can then be used to extend your application without the need to modify your core code.

Flask-PluginKit can also be said to be a glue, or a bridge, for connecting web and web plugins. It supports native plugins and third-party plugins from pypi, git, svn, and so on. In addition, the plugin is also very simple to write.


The following is a Chinese-English comparison:

Extension Point


TEP / tep / Template Extension Point


HEP / hep / Hook Extension Point


BEP / bep / Blueprint Extension Point


VEP / vep / View function Extension Point


DCP / dcp / Dynamic Connection Point


TCP / tcp / Template Context Processor / Context Processor








Developer / developer


Local Plugin

It is a local directory, it should be located in the plugins directory of the web application (of course, can also be defined as other directories), and is a legal python package, that is: plugins contain files, plugiin directories also Contains, this file identifies the directory as a package, and also identifies the plugin, which is the core code, plugin entry.

Third-party Plugin

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

The third-party plugins are free to use. The web application does not need to put the plugin code into a subdirectory. It only needs to be installed to the local machine using pip install or easy_install, 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; the user writes requirements.txt and installs the dependencies, which are called in the initialization, in one go, and almost no need to worry about subsequent third-party plugin upgrades.

For instructions on how to write third-party plugins, see Third party plugin

For official plugin’s github group:

Loading logic

Developers who are not Flask-PluginKit or its plugins can ignore this part.

The plugin load starts when the program starts. The load class is PluginManager, its destructor allows you to pass plugins_base (the default program directory), plugins_folder (the directory where the plugin is located), set the plugin absolute path directory, and also support factory mode, see the API documentation for more parameters.

The loading process is as follows:

  1. Call PluginManager normal mode or factory mode to initialize the extension.

  2. Scan the plugins_folder plugin directory and the packages that match the plugin rules will be dynamically loaded.

  3. Load third-party plugins in plugin_packages.

  4. Add template global variable.

  5. Support for multiple template directories.

  6. Add a view function that supports access to plugin directory static resources.

  7. Register hep, bep.

  8. Append the instance to app.extensions.