Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importable Python Modules for Python Plugins #130

Open
umesh-timalsina opened this issue Mar 25, 2021 · 0 comments
Open

Importable Python Modules for Python Plugins #130

umesh-timalsina opened this issue Mar 25, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request plugins spice

Comments

@umesh-timalsina
Copy link
Collaborator

Python plugins work great as standalone files to run. However, there are cases where you might want to reuse some aspects of the code written for one plugin in another. Currently, we run into this problem, where in multiple analytics could be run on a GMESubTree, but all those analytics do a transformation of that SubTree to PySpice/SPICE format. The resolution we found is via inheritance. Wherein, we first subclass the PluginBase from webgme_bindings and use that class elsewhere for our plugins. Now, we could argue about Composition vs Inheritance all day, but the problem we face is two folds and doesn't resolve either using Composition vs Inheritance .

  1. Since Python plugins are run as standalone files, importing/inheriting common Plugin code is a bit of a pain and relies on some importlib features offered by Python.
  2. Standalone python modules like utils, that don't require webGME specific concepts but could be used in multiple places has to be defined in the class / module file itself. Causing import issues as well.

A solution could be refactoring the common code into a separate Python package, which could be imported/used freely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugins spice
Projects
None yet
Development

No branches or pull requests

1 participant