Talks: Plug life into your codebase: Making an established Python codebase pluggable

Saturday - April 22nd, 2023 11:30 a.m.-noon in 255DEF

Presented by:


Experience Level:

Some experience

Description

You will learn about the pluggy Python framework and how it can be used to make your codebase plugin-friendly. As a real-life example, you will also learn about how the 10 year old conda codebase has recently gotten new life injected into it via a plugin API.

DETAILED ABSTRACT

What is a plugin?

A “plugin” is a customization or extra feature that is compatible with and discoverable by a particular piece of software. It is not part of the default codebase nor is it necessarily distributed as a default part of the software itself.

What is pluggy and how can it be used?

The pluggy Python framework (used by other projects such as pytest, tox, and devpi) is a great tool for incorporating a new plugin system. It provides both developers and software users with the ability to extend or modify the behavior of a Python program by enabling function hooking so that you can build pluggable systems with minimal fuss.

A real world example: Conda

How did conda incorporate a new plugin system for new features and refactors? Because of how pluggy works, the conda team’s developers created plugins simply by defining “hooks” and registering the custom plugins under the “conda” entry point namespace.

Conclusion: What other exciting things can be created with plugins?

Functionalities such as: - Authentication and authorization - Different storage backends (e.g., S3 buckets, etc.) - Development environment integrations (e.g., different shells) - Programming language support - Code editor integrations …and more are all possible to implement via a plugin system!