Ask HN: How to build a plug-in system with Python for a desktop app?
I'm building a desktop app with flutter and want to allow for plugins written in python. I'm planning on using protobuf to define the API and writing a utility package in Python that a plugin would use to define its behavior. The desktop app will run the plugin as a subprocess and communicate over the io pipes.
The main concern I have is with packaging the plugins and dealing with their dependencies. I want to avoid requiring anything more than python on a given machine in order to get the desktop app and plugins working. Should I bundle each plugins dependencies with the plugin? Or download dependencies as part of the installation of the plugin? Looking for general guidance on how to handle this or links to good articles on what's been done before
6 comments
[ 402 ms ] story [ 259 ms ] threadEssentially boils down to this:
Best Practices The correct approach to managing dependencies will depend on the specifics of your application and its plugins. However, here are some general best practices:
Document your dependencies: Make sure to provide clear documentation of all dependencies required for your plugin to function properly.
Specify dependency versions: When downloading dependencies during installation, always specify the version to ensure the plugin works as expected.
Regularly update your dependencies: Whether you bundle them with your plugin or download them during installation, make sure you regularly update your dependencies to patch any security vulnerabilities and benefit from new features or improvements.
Consider using virtual environments: To prevent conflicts between different plugins' dependencies, consider using Python's virtual environments. This isolates each plugin's dependencies in its own environment.
Leverage dependency management tools: Tools like Pipenv, Poetry, or conda can help you manage your dependencies effectively. These tools also support the creation of virtual environments.
https://stackoverflow.com/questions/26059111/build-a-wheel-e...