Skip to content

MinchinWeb/minchin.pelican.plugins.autoloader

Repository files navigation

AutoLoader

AutoLoader is a plugin for Pelican, a static site generator written in Python.

AutoLoader is designed to autoload the other Pelican plugins in my namespaces (minchin.pelican.plugins and minchin.pelican.readers). It can also be extended to autoload plugins in other namespaces, for example, to autoload the pelican.plugins namespace on versions of Pelican before 4.5 (when autoloading to those plugins was added to the Pelican core).

PyPI version number

Changelog

License

Download Count

Installation

The easiest way to install AutoLoader is through the use of pip. This will also install the required dependencies automatically.

pip install minchin.pelican.plugins.autoloader

Further configuration will depend on the version of Pelican you are running. On version 4.5 or newer and you haven't defined PLUGINS in your pelicanconf.py, nothing more in needed. On earlier versions of Pelican, or if you've defined PLUGINS, you'll need to add the autoloader to your list of plugins in your pelicanconf.py file:

# pelicanconf.py

PLUGINS = [
    # ...
    'minchin.pelican.plugins.autoloader',
    # ...
]

If you want to auto-load additional namespaces, you'll need to define the AUTOLOADER_NAMESPACES variable in your pelicanconf.py file:

# pelicanconf.py

from minchin.pelican.plugins import autoloader

AUTOLOADER_NAMESPACES = autoloader.DEFAULT_NAMESPACE_LIST + [
    "pelican.plugins",
    # other namespaces
]

If you need to disallow auto-loading of certain plugins, you'll need to define the AUTOLOADER_PLUGIN_BLACKLIST variable in your pelicanconf.py file. This only works when autoloading from defined namespaces. E.g.:

# pelicanconf.py

from minchin.pelican.plugins import autoloader

AUTOLOADER_PLUGIN_BLACKLIST = autoloader.DEFAULT_PLUGIN_BLACKLIST + [
    "pelican.plugins.misbehaving_plugin",
    # other plugins
]

Usage Notes

  • the plugins loaded by this plugin will not be shown when you run pelican-plugins

About

Pelican Plugin to auto-load plugins in my namespace

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages