PyCon Israel 2024

Your locale preferences have been saved. We like to think that we have excellent support for English in pretalx, but if you encounter issues or errors, please contact us!

Designing a plugin architecture in Python
09-16, 13:00–13:20 (Asia/Jerusalem), Hall 1
Language: English

Discover how to enhance your Python apps with plugin architectures using importlib.


In today's rapidly evolving software landscape, applications often need to be flexible and extensible to meet diverse user requirements. A plugin architecture allows users to enhance the capabilities of your application dynamically. This talk is aimed at developers who want to learn how to design and implement such an architecture in their Python applications.

We will begin by discussing the scenarios where a plugin architecture is beneficial (the why).
Next, we will dive into the technical details, presenting various strategies for implementing a plugin system (the how). These strategies include:

  • Simple dynamic imports for lightweight extensions.
  • Using entry points for more structured and discoverable plugins.
  • A registration system that allows plugins to declare capabilities and dependencies.
  • Improving performance - loading on the fly

We'll shortly discuss the challenges you might face, such as maintaining code quality, ensuring security, and managing dependencies.

To make these concepts concrete, we'll walk through a real-life example where I integrated a plugin system into a Jinja-based application, enabling users to register custom Jinja filters. This example will demonstrate how to leverage importlib to dynamically load and register user-defined plugins safely and efficiently.

Target Audience:

This talk is intended for Python developers of all levels who are interested in enhancing their applications with dynamic, user-defined extensions. Whether you're working on a personal project or a large-scale application in an organizational setting, you'll find valuable insights and practical techniques that you can apply immediately.


Expected experience level of participants

Intermediate

Target audience

Developers

Tsvi Mostovicz is a Senior Verification Engineer and Software & Verification Tech Lead at Intel. With a rich background from RAD Data Communications, AMD, and Marvell, he has honed his expertise in Python and verification engineering. At RAD, Tsvi integrated Jenkins CI pipelines and developed a Python-based regression manager. At Intel, his projects include Python-based code generation with Jinja and static analysis tools.

A Python enthusiast, Tsvi specializes in Jinja and pytest. He maintains the Jewish calendar integration for Home Assistant along with a Hebrew date library. Tsvi has also contributed to open-source projects by creating syntax highlighting files for Specman code in both VSCode and Sublime Text.

Outside work, Tsvi lives in Meitar, Israel, is a father of four, and enjoys reading historical fiction.