Skip to content

Commit

Permalink
new plugin feature layout
Browse files Browse the repository at this point in the history
  • Loading branch information
seb5g committed Nov 8, 2023
1 parent a4c5a12 commit d30a8e4
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 5 deletions.
8 changes: 8 additions & 0 deletions plugin_info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ author-email = '[email protected]'
[plugin-install]
#packages required for your plugin:
packages-required = ['pymodaq>4.0.0'] #list of required packages within quotes, eg: ["pyvisa", "numpy==1.19.3"] ...

[features] # defines the plugin features contained into this plugin
instruments = true # true if plugin contains instrument classes (else false, notice the lowercase for toml files)
extensions = false # true if plugins contains dashboard extensions
pid_models = false # true if plugins contains pid models
h5exporters = false # true if plugin contains custom h5 file exporters
scanners = false # true if plugin contains custom scan layout (daq_scan extensions)

18 changes: 16 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,27 @@
], )


entrypoints = {}
if 'features' in config:
if config['features'].get('instruments', False):
entrypoints['pymodaq.instruments'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
if config['features'].get('extensions', False):
entrypoints['pymodaq.extensions'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
if config['features'].get('pid_models', False):
entrypoints['pymodaq.pid_models'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
if config['features'].get('h5exporters', False):
entrypoints['pymodaq.h5exporters'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
if config['features'].get('scanners', False):
entrypoints['pymodaq.scanners'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'
else:
entrypoints['pymodaq.instruments'] = f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}'

setup(
version=version,
packages=find_packages(where='./src'),
package_dir={'': 'src'},
include_package_data=True,
entry_points={'pymodaq.plugins': f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}',
'pymodaq.pid_models': f"{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}"},
entry_points=entrypoints,
install_requires=['toml', ]+config['plugin-install']['packages-required'],
**setupOpts
)
File renamed without changes.
Empty file.
2 changes: 2 additions & 0 deletions src/pymodaq_plugins_teaching/resources/config_template.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#this is the configuration file of the plugin

15 changes: 15 additions & 0 deletions src/pymodaq_plugins_teaching/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
"""
Created the 31/08/2023
@author: Sebastien Weber
"""
from pathlib import Path

from pymodaq.utils.config import BaseConfig, USER


class Config(BaseConfig):
"""Main class to deal with configuration values for this plugin"""
config_template_path = Path(__file__).parent.joinpath('resources/config_template.toml')
config_name = f"config_{__package__.split('pymodaq_plugins_')[1]}"
5 changes: 2 additions & 3 deletions tests/test_plugin_package_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@ def test_imports():
mod = importlib.import_module(pkg_name)
assert hasattr(mod, 'config')
assert hasattr(mod, '__version__')
move_mod = importlib.import_module(f'{pkg_name}', 'daq_move_plugins')
importlib.import_module(f'{pkg_name}', 'daq_move_plugins')
importlib.import_module(f'{pkg_name}', 'daq_viewer_plugins')
importlib.import_module(f'{pkg_name}', 'extensions')
importlib.import_module(f'{pkg_name}', 'models')
importlib.import_module(f'{pkg_name}.daq_viewer_plugins', 'plugins_0D')
importlib.import_module(f'{pkg_name}.daq_viewer_plugins', 'plugins_1D')
importlib.import_module(f'{pkg_name}.daq_viewer_plugins', 'plugins_2D')
importlib.import_module(f'{pkg_name}.daq_viewer_plugins', 'plugins_ND')


def test_move_inst_plugins_name():
Expand All @@ -85,7 +84,7 @@ def test_move_has_mandatory_methods():
assert hasattr(klass, meth)


@pytest.mark.parametrize('dim', ('0D', '1D', '2D', 'ND'))
@pytest.mark.parametrize('dim', ('0D', '1D', '2D'))
def test_viewer_has_mandatory_methods(dim):
plugin_list, mod = get_viewer_plugins(dim)
for plug in plugin_list:
Expand Down

0 comments on commit d30a8e4

Please sign in to comment.