@@ -28,15 +28,15 @@ discover all of the Flask plugins installed:
2828 import importlib
2929 import pkgutil
3030
31- flask_plugins = {
31+ plugins = {
3232 name: importlib.import_module(name)
3333 for finder, name, ispkg
3434 in pkgutil.iter_modules()
3535 if name.startswith(' flask_' )
3636 }
3737
3838 If you had both the `Flask-SQLAlchemy `_ and `Flask-Talisman `_ plugins installed
39- then ``flask_plugins `` would be:
39+ then ``plugins `` would be:
4040
4141.. code-block :: python
4242
@@ -80,16 +80,16 @@ under that namespace:
8080 # the name.
8181 return pkgutil.iter_modules(ns_pkg.__path__ , ns_pkg.__name__ + " ." )
8282
83- myapp_plugins = {
83+ plugins = {
8484 name: importlib.import_module(name)
8585 for finder, name, ispkg
8686 in iter_namespace(myapp.plugins)
8787 }
8888
8989 Specifying ``myapp.plugins.__path__ `` to :func: `~pkgutil.iter_modules ` causes
9090it to only look for the modules directly under that namespace. For example,
91- if you have installed distributions that provide the modules ``myapp.plugin .a ``
92- and ``myapp.plugin .b `` then ``myapp_plugins `` in this case would be:
91+ if you have installed distributions that provide the modules ``myapp.plugins .a ``
92+ and ``myapp.plugins .b `` then ``plugins `` in this case would be:
9393
9494.. code-block :: python
9595
@@ -98,11 +98,11 @@ and ``myapp.plugin.b`` then ``myapp_plugins`` in this case would be:
9898 ' b' : < module: ' myapp.plugins.b' > ,
9999 }
100100
101- This sample uses a sub-package as the namespace package (``myapp.plugin ``), but
101+ This sample uses a sub-package as the namespace package (``myapp.plugins ``), but
102102it's also possible to use a top-level package for this purpose (such as
103103``myapp_plugins ``). How to pick the namespace to use is a matter of preference,
104- but it's not recommended to make your project's main top-level package (
105- ``myapp `` in this case) a namespace package for the purpose of plugins, as one
104+ but it's not recommended to make your project's main top-level package
105+ ( ``myapp `` in this case) a namespace package for the purpose of plugins, as one
106106bad plugin could cause the entire namespace to break which would in turn make
107107your project unimportable. For the "namespace sub-package" approach to work,
108108the plugin packages must omit the :file: `__init__.py ` for your top-level
0 commit comments