Skip to content




Plugin management.

AllenNLP supports loading "plugins" dynamically. A plugin is just a Python package that provides custom registered classes or additional allennlp subcommands.

In order for AllenNLP to find your plugins, you have to create either a local plugins file named .allennlp_plugins in the directory where the allennlp command is run, or a global plugins file at ~/.allennlp/plugins. The file should list the plugin modules that you want to be loaded, one per line.


LOCAL_PLUGINS_FILENAME = ".allennlp_plugins"

Local plugin files should have this name.


GLOBAL_PLUGINS_FILENAME = str(Path.home() / ".allennlp" / "plugins")

The global plugins file will be found here.


DEFAULT_PLUGINS = ("allennlp_models", "allennlp_semparse", "allennlp_server")

Default plugins do not need to be declared in a plugins file. They will always be imported when they are installed in the current Python environment.


def discover_file_plugins(
    plugins_filename: str = LOCAL_PLUGINS_FILENAME
) -> Iterable[str]

Returns an iterable of the plugins found, declared within a file whose path is plugins_filename.


def discover_plugins() -> Iterable[str]

Returns an iterable of the plugins found.


def import_plugins() -> None

Imports the plugins found with discover_plugins().