Plugin System#

Pyccel’s plugin system is built on pluggy.

How it works#

Available hooks are declared in pyccel/plugins/hookspecs.py. Plugins implement the three hooks required for the command line interface, as well as any additional hooks relevant for the functionality. The helpers in pyccel/plugins/plugin_tools.py build augmented parser/codegen/wrapping classes by layering plugin methods on top of the base classes.

Writing a plugin#

  1. Create a module that imports hookimpl from pyccel and decorates each hook implementation with it.

  2. Publish it as a Python package with the entry-point pyccel (see pluggy docs and setuptools docs for more information).

Built-in plugins#

Plugin

Location

Purpose

LineAnnot

[pyccel/plugins/LineAnnot/](https://github.com/pyccel/pyccel/tree/devel/api/pyccel.plugins.LineAnnot.rst

Inserts source-line comments into generated code

Note#

The set of available hooks is still evolving. Always check hookspecs.py for the current interface.