You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/features/general/plugins.html
+39-6Lines changed: 39 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -520,12 +520,17 @@
520
520
<h2>What is a plugin?<aclass="headerlink" href="#what-is-a-plugin" title="Link to this heading">#</a></h2>
521
521
<p>A plugin is a Python module that is loaded at startup by DataLab. A plugin may
522
522
add new features to DataLab, or modify existing features.</p>
523
-
<p>A plugin is a Python module that contains a class derived from the
524
-
<aclass="reference internal" href="#cdl.plugins.PluginBase" title="cdl.plugins.PluginBase"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">cdl.plugins.PluginBase</span></code></a> class. The name of the class is not important,
525
-
as long as it is derived from <aclass="reference internal" href="#cdl.plugins.PluginBase" title="cdl.plugins.PluginBase"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">cdl.plugins.PluginBase</span></code></a> and has a
526
-
<codeclass="docutils literal notranslate"><spanclass="pre">PLUGIN_INFO</span></code> attribute that is an instance of the <aclass="reference internal" href="#cdl.plugins.PluginInfo" title="cdl.plugins.PluginInfo"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">cdl.plugins.PluginInfo</span></code></a>
527
-
class. The <codeclass="docutils literal notranslate"><spanclass="pre">PLUGIN_INFO</span></code> attribute is used by DataLab to retrieve information
528
-
about the plugin.</p>
523
+
<p>A plugin is a Python module which file name starts with <codeclass="docutils literal notranslate"><spanclass="pre">cdl_</span></code>, and which
524
+
contains a class derived from the <aclass="reference internal" href="#cdl.plugins.PluginBase" title="cdl.plugins.PluginBase"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">cdl.plugins.PluginBase</span></code></a> class.
525
+
The name of the class is not important, as long as it is derived from
526
+
<aclass="reference internal" href="#cdl.plugins.PluginBase" title="cdl.plugins.PluginBase"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">cdl.plugins.PluginBase</span></code></a> and has a <codeclass="docutils literal notranslate"><spanclass="pre">PLUGIN_INFO</span></code> attribute that is an
527
+
instance of the <aclass="reference internal" href="#cdl.plugins.PluginInfo" title="cdl.plugins.PluginInfo"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">cdl.plugins.PluginInfo</span></code></a> class. The <codeclass="docutils literal notranslate"><spanclass="pre">PLUGIN_INFO</span></code> attribute
528
+
is used by DataLab to retrieve information about the plugin.</p>
529
+
<divclass="admonition note">
530
+
<pclass="admonition-title">Note</p>
531
+
<p>DataLab’s plugin discovery mechanism will only load plugins that are defined
532
+
in Python files which names start with <codeclass="docutils literal notranslate"><spanclass="pre">cdl_</span></code> (e.g. <codeclass="docutils literal notranslate"><spanclass="pre">cdl_myplugin.py</span></code>).</p>
533
+
</div>
529
534
</section>
530
535
<sectionid="where-to-put-a-plugin">
531
536
<h2>Where to put a plugin?<aclass="headerlink" href="#where-to-put-a-plugin" title="Link to this heading">#</a></h2>
@@ -542,6 +547,33 @@ <h2>Where to put a plugin?<a class="headerlink" href="#where-to-put-a-plugin" ti
542
547
only (i.e. it is not recommended to put your own plugins there).</p></li>
543
548
</ul>
544
549
</section>
550
+
<sectionid="how-to-develop-a-plugin">
551
+
<h2>How to develop a plugin?<aclass="headerlink" href="#how-to-develop-a-plugin" title="Link to this heading">#</a></h2>
552
+
<p>To develop a plugin, you may start by deriving from one of the example plugins
553
+
(see below) and modify it to suit your needs.</p>
554
+
<p>If you want to code a plugin in your usual Python development environment (preferably
555
+
with an IDE like <aclass="reference external" href="https://www.spyder-ide.org/">Spyder</a>) and take advantage of the
556
+
code completion, you can add the <cite>cdl</cite> package to your Python path.</p>
557
+
<p>This can be done:</p>
558
+
<ulclass="simple">
559
+
<li><p>By installing DataLab in your Python environment (using one of the following methods:
0 commit comments