Repository: force-h2020/force-bdss

Issue:
force.bdss.mco.bundles inconsistent with the other extension point ids
In the extension point for MCO bundles, the naming is inconsistent with the other two (kpi and datasources)

We should use the singular I think. mco.bundles is fine, but data_sources.bundles is not. Should be data_source.bundles.


Discussion:

Patch:
diff --git a/doc/source/api/force_bdss.data_sources.rst b/doc/source/api/force_bdss.data_sources.rst
index 9424970..7df2d7d 100644
--- a/doc/source/api/force_bdss.data_sources.rst
+++ b/doc/source/api/force_bdss.data_sources.rst
@@ -1,6 +1,13 @@
 force_bdss.data_sources package
 ===============================
 
+Subpackages
+-----------
+
+.. toctree::
+
+    force_bdss.data_sources.tests
+
 Submodules
 ----------
 
@@ -12,6 +19,14 @@ force_bdss.data_sources.base_data_source module
     :undoc-members:
     :show-inheritance:
 
+force_bdss.data_sources.base_data_source_bundle module
+------------------------------------------------------
+
+.. automodule:: force_bdss.data_sources.base_data_source_bundle
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 force_bdss.data_sources.base_data_source_model module
 -----------------------------------------------------
 
diff --git a/doc/source/api/force_bdss.kpi.rst b/doc/source/api/force_bdss.kpi.rst
index 2fb8b90..b90b1b5 100644
--- a/doc/source/api/force_bdss.kpi.rst
+++ b/doc/source/api/force_bdss.kpi.rst
@@ -1,6 +1,13 @@
 force_bdss.kpi package
 ======================
 
+Subpackages
+-----------
+
+.. toctree::
+
+    force_bdss.kpi.tests
+
 Submodules
 ----------
 
@@ -12,6 +19,14 @@ force_bdss.kpi.base_kpi_calculator module
     :undoc-members:
     :show-inheritance:
 
+force_bdss.kpi.base_kpi_calculator_bundle module
+------------------------------------------------
+
+.. automodule:: force_bdss.kpi.base_kpi_calculator_bundle
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 force_bdss.kpi.base_kpi_calculator_model module
 -----------------------------------------------
 
diff --git a/doc/source/api/force_bdss.mco.rst b/doc/source/api/force_bdss.mco.rst
index 6a1c4e4..b0d6621 100644
--- a/doc/source/api/force_bdss.mco.rst
+++ b/doc/source/api/force_bdss.mco.rst
@@ -1,6 +1,13 @@
 force_bdss.mco package
 ======================
 
+Subpackages
+-----------
+
+.. toctree::
+
+    force_bdss.mco.tests
+
 Submodules
 ----------
 
@@ -28,6 +35,14 @@ force_bdss.mco.base_multi_criteria_optimizer module
     :undoc-members:
     :show-inheritance:
 
+force_bdss.mco.base_multi_criteria_optimizer_bundle module
+----------------------------------------------------------
+
+.. automodule:: force_bdss.mco.base_multi_criteria_optimizer_bundle
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 force_bdss.mco.i_multi_criteria_optimizer_bundle module
 -------------------------------------------------------
 
diff --git a/doc/source/api/force_bdss.rst b/doc/source/api/force_bdss.rst
index 585e573..2c20d82 100644
--- a/doc/source/api/force_bdss.rst
+++ b/doc/source/api/force_bdss.rst
@@ -74,10 +74,10 @@ force_bdss.core_mco_driver module
     :undoc-members:
     :show-inheritance:
 
-force_bdss.id_generators module
--------------------------------
+force_bdss.ids module
+---------------------
 
-.. automodule:: force_bdss.id_generators
+.. automodule:: force_bdss.ids
     :members:
     :undoc-members:
     :show-inheritance:
diff --git a/force_bdss/api.py b/force_bdss/api.py
index c1022dc..cb5c046 100644
--- a/force_bdss/api.py
+++ b/force_bdss/api.py
@@ -1,5 +1,5 @@
 from .base_extension_plugin import BaseExtensionPlugin  # noqa
-from .id_generators import bundle_id  # noqa
+from .ids import bundle_id  # noqa
 
 from .data_sources.base_data_source_model import BaseDataSourceModel  # noqa
 from .data_sources.data_source_result import DataSourceResult  # noqa
diff --git a/force_bdss/base_extension_plugin.py b/force_bdss/base_extension_plugin.py
index f940d35..2929ff3 100644
--- a/force_bdss/base_extension_plugin.py
+++ b/force_bdss/base_extension_plugin.py
@@ -1,6 +1,7 @@
 from envisage.plugin import Plugin
 from traits.trait_types import List
 
+from .ids import ExtensionPointID
 from .data_sources.i_data_source_bundle import IDataSourceBundle
 from .kpi.i_kpi_calculator_bundle import IKPICalculatorBundle
 from .mco.i_multi_criteria_optimizer_bundle import \
@@ -25,17 +26,17 @@ class BaseExtensionPlugin(Plugin):
     #: A list of available Multi Criteria Optimizers this plugin exports.
     mco_bundles = List(
         IMultiCriteriaOptimizerBundle,
-        contributes_to='force.bdss.mco.bundles'
+        contributes_to=ExtensionPointID.MCO_BUNDLES
     )
 
     #: A list of the available Data Sources this plugin exports.
     data_source_bundles = List(
         IDataSourceBundle,
-        contributes_to='force.bdss.data_sources.bundles'
+        contributes_to=ExtensionPointID.DATA_SOURCE_BUNDLES
     )
 
     #: A list of the available KPI calculators this plugin exports.
     kpi_calculator_bundles = List(
         IKPICalculatorBundle,
-        contributes_to='force.bdss.kpi_calculators.bundles'
+        contributes_to=ExtensionPointID.KPI_CALCULATOR_BUNDLES
     )
diff --git a/force_bdss/bundle_registry_plugin.py b/force_bdss/bundle_registry_plugin.py
index 2655bf7..778826d 100644
--- a/force_bdss/bundle_registry_plugin.py
+++ b/force_bdss/bundle_registry_plugin.py
@@ -2,6 +2,7 @@ from envisage.extension_point import ExtensionPoint
 from envisage.plugin import Plugin
 from traits.api import List
 
+from force_bdss.ids import ExtensionPointID
 from .data_sources.i_data_source_bundle import (
     IDataSourceBundle)
 from .kpi.i_kpi_calculator_bundle import IKPICalculatorBundle
@@ -28,19 +29,19 @@ class BundleRegistryPlugin(Plugin):
     #: This will be populated by MCO plugins.
     mco_bundles = ExtensionPoint(
         List(IMultiCriteriaOptimizerBundle),
-        id='force.bdss.mco.bundles')
+        id=ExtensionPointID.MCO_BUNDLES)
 
     #: A list of the available Data Sources.
     #: It will be populated by plugins.
     data_source_bundles = ExtensionPoint(
         List(IDataSourceBundle),
-        id='force.bdss.data_sources.bundles')
+        id=ExtensionPointID.DATA_SOURCE_BUNDLES)
 
     #: A list of the available Key Performance Indicator calculators.
     #: It will be populated by plugins.
     kpi_calculator_bundles = ExtensionPoint(
         List(IKPICalculatorBundle),
-        id='force.bdss.kpi_calculators.bundles')
+        id=ExtensionPointID.KPI_CALCULATOR_BUNDLES)
 
     def data_source_bundle_by_id(self, id):
         """Finds a given data source bundle by means of its id.
diff --git a/force_bdss/id_generators.py b/force_bdss/ids.py
similarity index 60%
rename from force_bdss/id_generators.py
rename to force_bdss/ids.py
index d89eca0..76b3016 100644
--- a/force_bdss/id_generators.py
+++ b/force_bdss/ids.py
@@ -1,6 +1,19 @@
 import six
 
 
+class ExtensionPointID:
+    """The envisage extension points ids for the bundles ExtensionPoints.
+    These are populated by the envisage plugins.
+
+    The plugin developer generally does not have to handle these identifiers,
+    as they just have to reimplement the plugin base class and implement
+    the appropriate default methods.
+    """
+    MCO_BUNDLES = 'force.bdss.mco.bundles'
+    DATA_SOURCE_BUNDLES = 'force.bdss.data_source.bundles'
+    KPI_CALCULATOR_BUNDLES = 'force.bdss.kpi_calculator.bundles'
+
+
 def bundle_id(producer, identifier):
     """Creates an id for the bundle.
 


Test patch:
diff --git a/doc/source/api/force_bdss.io.tests.rst b/doc/source/api/force_bdss.io.tests.rst
index feac0db..d7512c8 100644
--- a/doc/source/api/force_bdss.io.tests.rst
+++ b/doc/source/api/force_bdss.io.tests.rst
@@ -12,6 +12,14 @@ force_bdss.io.tests.test_workflow_reader module
     :undoc-members:
     :show-inheritance:
 
+force_bdss.io.tests.test_workflow_writer module
+-----------------------------------------------
+
+.. automodule:: force_bdss.io.tests.test_workflow_writer
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
 
 Module contents
 ---------------
diff --git a/force_bdss/io/tests/test_workflow_writer.py b/force_bdss/io/tests/test_workflow_writer.py
index e6f81ec..25103a0 100644
--- a/force_bdss/io/tests/test_workflow_writer.py
+++ b/force_bdss/io/tests/test_workflow_writer.py
@@ -10,7 +10,7 @@ try:
 except ImportError:
     from unittest import mock
 
-from force_bdss.id_generators import bundle_id
+from force_bdss.ids import bundle_id
 from force_bdss.io.workflow_writer import WorkflowWriter
 from force_bdss.mco.base_mco_model import BaseMCOModel
 from force_bdss.mco.i_multi_criteria_optimizer_bundle import \
diff --git a/force_bdss/tests/test_bundle_registry_plugin.py b/force_bdss/tests/test_bundle_registry_plugin.py
index d689389..c709e57 100644
--- a/force_bdss/tests/test_bundle_registry_plugin.py
+++ b/force_bdss/tests/test_bundle_registry_plugin.py
@@ -2,7 +2,7 @@ import unittest
 
 from force_bdss.base_extension_plugin import (
     BaseExtensionPlugin)
-from force_bdss.id_generators import bundle_id
+from force_bdss.ids import bundle_id
 
 try:
     import mock
diff --git a/force_bdss/tests/test_id_generators.py b/force_bdss/tests/test_id_generators.py
index 85d240a..2317cf1 100644
--- a/force_bdss/tests/test_id_generators.py
+++ b/force_bdss/tests/test_id_generators.py
@@ -1,6 +1,6 @@
 import unittest
 
-from force_bdss.id_generators import bundle_id
+from force_bdss.ids import bundle_id
 
 
 class TestIdGenerators(unittest.TestCase):