Skip to content

Commit bf72c03

Browse files
committed
Update documentation
1 parent 82a1af4 commit bf72c03

File tree

18 files changed

+147
-21
lines changed

18 files changed

+147
-21
lines changed
19 Bytes
Binary file not shown.

en/.doctrees/environment.pickle

10.5 KB
Binary file not shown.
8.06 KB
Binary file not shown.

en/_images/i_beautiful.png

-103 Bytes
Loading

en/_images/s_beautiful.png

-214 Bytes
Loading

en/_sources/features/general/plugins.rst.txt

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ What is a plugin?
2424
A plugin is a Python module that is loaded at startup by DataLab. A plugin may
2525
add new features to DataLab, or modify existing features.
2626

27-
A plugin is a Python module that contains a class derived from the
28-
:class:`cdl.plugins.PluginBase` class. The name of the class is not important,
29-
as long as it is derived from :class:`cdl.plugins.PluginBase` and has a
30-
``PLUGIN_INFO`` attribute that is an instance of the :class:`cdl.plugins.PluginInfo`
31-
class. The ``PLUGIN_INFO`` attribute is used by DataLab to retrieve information
32-
about the plugin.
27+
A plugin is a Python module which file name starts with ``cdl_``, and which
28+
contains a class derived from the :class:`cdl.plugins.PluginBase` class.
29+
The name of the class is not important, as long as it is derived from
30+
:class:`cdl.plugins.PluginBase` and has a ``PLUGIN_INFO`` attribute that is an
31+
instance of the :class:`cdl.plugins.PluginInfo` class. The ``PLUGIN_INFO`` attribute
32+
is used by DataLab to retrieve information about the plugin.
33+
34+
.. note::
35+
36+
DataLab's plugin discovery mechanism will only load plugins that are defined
37+
in Python files which names start with ``cdl_`` (e.g. ``cdl_myplugin.py``).
3338

3439
Where to put a plugin?
3540
^^^^^^^^^^^^^^^^^^^^^^
@@ -49,6 +54,34 @@ Special additional locations are available for plugins:
4954
- The `plugins` directory in the `cdl` package in case for internal plugins
5055
only (i.e. it is not recommended to put your own plugins there).
5156

57+
How to develop a plugin?
58+
^^^^^^^^^^^^^^^^^^^^^^^^
59+
60+
To develop a plugin, you may start by deriving from one of the example plugins
61+
(see below) and modify it to suit your needs.
62+
63+
If you want to code a plugin in your usual Python development environment (preferably
64+
with an IDE like `Spyder <https://www.spyder-ide.org/>`_) and take advantage of the
65+
code completion, you can add the `cdl` package to your Python path.
66+
67+
This can be done:
68+
69+
- By installing DataLab in your Python environment (using one of the following methods:
70+
:ref:`install_pip`, :ref:`install_wheel`, or :ref:`install_source`),
71+
72+
- Or by adding the `cdl` package to your Python path manually:
73+
74+
- Download the DataLab source code from the `PyPI page <https://pypi.org/project/cdl/>`_,
75+
- Unzip the source code to a folder on your computer,
76+
- Add the `cdl` package to your Python path (e.g. by using the *PYTHONPATH Manager* in Spyder).
77+
78+
.. note::
79+
80+
Even if you have installed the `cdl` package properly in your Python environment,
81+
you won't be able to run the DataLab application from your development environment
82+
to test your plugin. You will need to run DataLab from the command line or from
83+
the shortcut created during the installation.
84+
5285
Example: processing plugin
5386
^^^^^^^^^^^^^^^^^^^^^^^^^^
5487

en/features/general/plugins.html

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,17 @@
520520
<h2>What is a plugin?<a class="headerlink" href="#what-is-a-plugin" title="Link to this heading">#</a></h2>
521521
<p>A plugin is a Python module that is loaded at startup by DataLab. A plugin may
522522
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-
<a class="reference internal" href="#cdl.plugins.PluginBase" title="cdl.plugins.PluginBase"><code class="xref py py-class docutils literal notranslate"><span class="pre">cdl.plugins.PluginBase</span></code></a> class. The name of the class is not important,
525-
as long as it is derived from <a class="reference internal" href="#cdl.plugins.PluginBase" title="cdl.plugins.PluginBase"><code class="xref py py-class docutils literal notranslate"><span class="pre">cdl.plugins.PluginBase</span></code></a> and has a
526-
<code class="docutils literal notranslate"><span class="pre">PLUGIN_INFO</span></code> attribute that is an instance of the <a class="reference internal" href="#cdl.plugins.PluginInfo" title="cdl.plugins.PluginInfo"><code class="xref py py-class docutils literal notranslate"><span class="pre">cdl.plugins.PluginInfo</span></code></a>
527-
class. The <code class="docutils literal notranslate"><span class="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 <code class="docutils literal notranslate"><span class="pre">cdl_</span></code>, and which
524+
contains a class derived from the <a class="reference internal" href="#cdl.plugins.PluginBase" title="cdl.plugins.PluginBase"><code class="xref py py-class docutils literal notranslate"><span class="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+
<a class="reference internal" href="#cdl.plugins.PluginBase" title="cdl.plugins.PluginBase"><code class="xref py py-class docutils literal notranslate"><span class="pre">cdl.plugins.PluginBase</span></code></a> and has a <code class="docutils literal notranslate"><span class="pre">PLUGIN_INFO</span></code> attribute that is an
527+
instance of the <a class="reference internal" href="#cdl.plugins.PluginInfo" title="cdl.plugins.PluginInfo"><code class="xref py py-class docutils literal notranslate"><span class="pre">cdl.plugins.PluginInfo</span></code></a> class. The <code class="docutils literal notranslate"><span class="pre">PLUGIN_INFO</span></code> attribute
528+
is used by DataLab to retrieve information about the plugin.</p>
529+
<div class="admonition note">
530+
<p class="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 <code class="docutils literal notranslate"><span class="pre">cdl_</span></code> (e.g. <code class="docutils literal notranslate"><span class="pre">cdl_myplugin.py</span></code>).</p>
533+
</div>
529534
</section>
530535
<section id="where-to-put-a-plugin">
531536
<h2>Where to put a plugin?<a class="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
542547
only (i.e. it is not recommended to put your own plugins there).</p></li>
543548
</ul>
544549
</section>
550+
<section id="how-to-develop-a-plugin">
551+
<h2>How to develop a plugin?<a class="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 <a class="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+
<ul class="simple">
559+
<li><p>By installing DataLab in your Python environment (using one of the following methods:
560+
<a class="reference internal" href="../../intro/installation.html#install-pip"><span class="std std-ref">Package manager pip</span></a>, <a class="reference internal" href="../../intro/installation.html#install-wheel"><span class="std std-ref">Wheel package</span></a>, or <a class="reference internal" href="../../intro/installation.html#install-source"><span class="std std-ref">Source package</span></a>),</p></li>
561+
<li><p>Or by adding the <cite>cdl</cite> package to your Python path manually:</p>
562+
<ul>
563+
<li><p>Download the DataLab source code from the <a class="reference external" href="https://pypi.org/project/cdl/">PyPI page</a>,</p></li>
564+
<li><p>Unzip the source code to a folder on your computer,</p></li>
565+
<li><p>Add the <cite>cdl</cite> package to your Python path (e.g. by using the <em>PYTHONPATH Manager</em> in Spyder).</p></li>
566+
</ul>
567+
</li>
568+
</ul>
569+
<div class="admonition note">
570+
<p class="admonition-title">Note</p>
571+
<p>Even if you have installed the <cite>cdl</cite> package properly in your Python environment,
572+
you won’t be able to run the DataLab application from your development environment
573+
to test your plugin. You will need to run DataLab from the command line or from
574+
the shortcut created during the installation.</p>
575+
</div>
576+
</section>
545577
<section id="example-processing-plugin">
546578
<h2>Example: processing plugin<a class="headerlink" href="#example-processing-plugin" title="Link to this heading">#</a></h2>
547579
<p>Here is a simple example of a plugin that adds a new features to DataLab.</p>
@@ -1187,6 +1219,7 @@ <h3>DataLab plugin system<a class="headerlink" href="#datalab-plugin-system" tit
11871219
<ul class="visible nav section-nav flex-column">
11881220
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#what-is-a-plugin">What is a plugin?</a></li>
11891221
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#where-to-put-a-plugin">Where to put a plugin?</a></li>
1222+
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#how-to-develop-a-plugin">How to develop a plugin?</a></li>
11901223
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#example-processing-plugin">Example: processing plugin</a></li>
11911224
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#example-input-output-plugin">Example: input/output plugin</a></li>
11921225
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#other-examples">Other examples</a></li>

en/features/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ <h2>General features<a class="headerlink" href="#general-features" title="Link t
560560
<li class="toctree-l1"><a class="reference internal" href="general/plugins.html">Plugins</a><ul>
561561
<li class="toctree-l2"><a class="reference internal" href="general/plugins.html#what-is-a-plugin">What is a plugin?</a></li>
562562
<li class="toctree-l2"><a class="reference internal" href="general/plugins.html#where-to-put-a-plugin">Where to put a plugin?</a></li>
563+
<li class="toctree-l2"><a class="reference internal" href="general/plugins.html#how-to-develop-a-plugin">How to develop a plugin?</a></li>
563564
<li class="toctree-l2"><a class="reference internal" href="general/plugins.html#example-processing-plugin">Example: processing plugin</a></li>
564565
<li class="toctree-l2"><a class="reference internal" href="general/plugins.html#example-input-output-plugin">Example: input/output plugin</a></li>
565566
<li class="toctree-l2"><a class="reference internal" href="general/plugins.html#other-examples">Other examples</a></li>

en/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
19 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)