<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=BenEisenbraun</id>
	<title>PyMOL Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=BenEisenbraun"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php/Special:Contributions/BenEisenbraun"/>
	<updated>2026-05-04T14:17:43Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=PluginArchitecture&amp;diff=7198</id>
		<title>PluginArchitecture</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=PluginArchitecture&amp;diff=7198"/>
		<updated>2010-08-04T17:32:10Z</updated>

		<summary type="html">&lt;p&gt;BenEisenbraun: /* Ideas/Features for the New Plugin System */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page concerns the development for new PyMOL Plugin Architecture.  We are requesting ideas, code, etc on how to best implement a successful plug in system.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
PyMOL enjoys widespread use as 3D molecular visualization program with strengths in rendering and visualization.  PyMOL at current does not have a robust extension mechanism for adding new plug-in based features to PyMOL.  It only allows a script of one file and has very limited support for installation and removal.  This project aims to correct that lacking functionality.  We aim for simplicity and robustness especially in a cross-platform manner.&lt;br /&gt;
&lt;br /&gt;
A '''Plug-In''' (or '''Plugin''') is a modular piece of software that extends PyMOL's functionality.&lt;br /&gt;
&lt;br /&gt;
== Wanna' Help? ==&lt;br /&gt;
If you want to take part in helping out with this, please send Jason Vertrees an email letting him know as such.&lt;br /&gt;
&lt;br /&gt;
= Review of Current Plugin System =&lt;br /&gt;
&lt;br /&gt;
Essentially the current system inits all the scripts in the startup directory, which adds their entry to the Plugins menu.  When called, it fires off a command passing to it PyMOL's Tk menu.  The instance can get access to pymol's cmd layer with, &amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;from pymol import cmd&amp;lt;/source&amp;gt;.  Also, as it's in Python, the user can extend Python (even in C) or call low-level functions utilizing the web or touching the file system.&lt;br /&gt;
&lt;br /&gt;
* For a tutorial on the current system. see [[Plugins_Tutorial]].&lt;br /&gt;
&lt;br /&gt;
= Ideas/Features for the New Plugin System =&lt;br /&gt;
* Plugins must be ''safe''. That is, they must not destroy the users' data for file system.&lt;br /&gt;
* Plugins must be ''secure'' in that they do not transmit data the user doesn't want transmitted.&lt;br /&gt;
** We can take an approach like Warren did with sessions--warn the user on sessions s/he didn't create and ask for trusting or not.&lt;br /&gt;
* Plugins should be able to query PyMOL for features&lt;br /&gt;
* PyMOL should take care of unpacking, installing, uninstalling, updating (?) the plugins&lt;br /&gt;
* '''MUST''' be backwards compatible with the current system&lt;br /&gt;
* '''MUST''' run cross platform&lt;br /&gt;
* Save user-specific information&lt;br /&gt;
* Support proxy information/setup for downloading scripts&lt;br /&gt;
* Support a personal plugin directory, so users can administer their own plugins in situations where the PyMOL installation is read-only and shared among many users.&lt;br /&gt;
&lt;br /&gt;
== More than one file per plugin ==&lt;br /&gt;
&lt;br /&gt;
I'd like plugins that behave like proper Python modules with the ability to span multiple files/directories. One simple way to do this would be to distribute plugins as zip files. E.g. if we have a directory Foo that contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
MyMod&lt;br /&gt;
    __init__.py&lt;br /&gt;
          &amp;quot;&amp;quot;&amp;quot;Some documentation here&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Foo.py&lt;br /&gt;
        def doit():&lt;br /&gt;
            print &amp;quot;It is done!&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can zip it up like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
zip MyMod.zip Foo/*&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you stick MyMod.zip in a plugins directory like /blahblah/Pymol/plugins/MyMod.zip&lt;br /&gt;
you can then say this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
sys.path.append('/blahblah/Pymol/plugins/MyMod.zip')&lt;br /&gt;
from MyMod import Foo&lt;br /&gt;
Foo.doit()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Python does not impose the restriction that the module/directory name (MyMod) should be the same as the zip file name (MyMod.zip), but we might want to.&lt;br /&gt;
&lt;br /&gt;
Then we need to formally spell out the API by which the Plugin is launched.&lt;br /&gt;
&lt;br /&gt;
This makes it very easy to install/uninstall plugins, and PyMOL can just have a simple loop that iterates over the plugins directory, adds the appropriate things to sys.path, verifies that the resulting objects support the API, and adds them to the menu.&lt;br /&gt;
&lt;br /&gt;
== Config files ==&lt;br /&gt;
&lt;br /&gt;
Some sort of persistent config files where users can store things like paths to relevant files, settings, etc. would be very useful. The APBS plugin, for instance, is a bit of a bother to use when you have APBS installed in a non-standard location. It would be very convenient if you could set the location once and have it persist.&lt;br /&gt;
&lt;br /&gt;
== Meeting Notes ==&lt;br /&gt;
=== May 3, 2010 ===&lt;br /&gt;
In attendance: Nathan Baker, Mike Beachy, Greg Landrum, David Gohara, Yong Huang, Jay Ponder, Jason Vertrees&lt;br /&gt;
&lt;br /&gt;
Additional ideas people wanted to see implemented:&lt;br /&gt;
* As scripts will be accessing internal data for computation, improved access to PyMOL internal data structures, like DX maps, is required.&lt;br /&gt;
** I/O for maps is the rate limiting step;&lt;br /&gt;
** data structures can be large, so skipping the disk would also be nice&lt;br /&gt;
* Skeleton code for plugins would help people write new ones; good tutorial as well; we need to make things easier for the novice&lt;br /&gt;
** Make a new site for plugins: plugins dot pymol dot org?&lt;br /&gt;
&lt;br /&gt;
= Liked Plugin Systems =&lt;br /&gt;
* [https://addons.mozilla.org/en-US/developers FireFox Devel/Docs]&lt;br /&gt;
* Google Chrome -- URL?&lt;br /&gt;
&lt;br /&gt;
= Disliked Plugin Systems =&lt;br /&gt;
&lt;br /&gt;
= Links on the topic =&lt;br /&gt;
* [http://stackoverflow.com/questions/323202/designing-extensible-software-plugin-architecture StackOverflow Discussion]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Open/closed_principle Dr. Meyers' Open/Closed Principle]&lt;br /&gt;
* [http://www.codeguru.com/cpp/misc/misc/plug-insadd-ins/article.php/c3879 Nice overview in C]&lt;br /&gt;
&lt;br /&gt;
= The Name =&lt;br /&gt;
* Plugins, Plug-Ins?&lt;br /&gt;
* Add-ons?&lt;br /&gt;
* Extensions?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Developers]]&lt;/div&gt;</summary>
		<author><name>BenEisenbraun</name></author>
	</entry>
</feed>