Plugins#

Polars allows you to extend its functionality with either Expression plugins or IO plugins. See the user guide for more information and resources.

Expression plugins#

Expression plugins are the preferred way to create user defined functions. They allow you to compile a Rust function and register that as an expression into the Polars library. The Polars engine will dynamically link your function at runtime and your expression will run almost as fast as native expressions. Note that this works without any interference of Python and thus no GIL contention.

See the expression plugins section of the user guide for more information.

plugins.register_plugin_function(*, ...[, ...])

Register a plugin function.

IO plugins#

IO plugins allow you to register different file formats as sources to the Polars engines.

See the IO plugins section of the user guide for more information.

Note

The io.plugins module is not imported by default in order to optimise import speed of the primary polars module. Either import polars.io.plugins and then use that namespace, or import register_io_source from the full module path, e.g.:

from polars.io.plugins import register_io_source

io.plugins.register_io_source(io_source, *, ...)

Register your IO plugin and initialize a LazyFrame.