bec-testing-plugin 0.3.0__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/.copier-answers.yml +1 -1
  2. bec_testing_plugin-0.3.2/.gitea/workflows/create_update_pr.yml +70 -0
  3. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/.github/workflows/ci.yml +7 -2
  4. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/CHANGELOG.md +19 -0
  5. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/PKG-INFO +3 -3
  6. bec_testing_plugin-0.3.2/bec_testing_plugin/bec_widgets/widgets/client.py +61 -0
  7. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/scans/custom_scan.py +1 -1
  8. bec_testing_plugin-0.3.2/bec_testing_plugin/scans/device_progress_scan.py +37 -0
  9. bec_testing_plugin-0.3.2/bec_testing_plugin/scans/scan_customization/scan_components.py +12 -0
  10. bec_testing_plugin-0.3.2/bec_testing_plugin/scans/scan_customization/scan_modifier.py +31 -0
  11. bec_testing_plugin-0.3.2/bec_testing_plugin/services/__init__.py +0 -0
  12. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/pyproject.toml +5 -2
  13. bec_testing_plugin-0.3.0/.gitlab-ci.yml +0 -7
  14. bec_testing_plugin-0.3.0/bec_testing_plugin/bec_widgets/widgets/client.py +0 -31
  15. bec_testing_plugin-0.3.0/bec_testing_plugin/scans/device_progress_scan.py +0 -10
  16. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/.git_hooks/post-commit +0 -0
  17. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/.git_hooks/pre-commit +0 -0
  18. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/.github/workflows/semantic_release.yml +0 -0
  19. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/.gitignore +0 -0
  20. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/LICENSE +0 -0
  21. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/README.md +0 -0
  22. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/__init__.py +0 -0
  23. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_ipython_client/__init__.py +0 -0
  24. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_ipython_client/high_level_interface/__init__.py +0 -0
  25. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_ipython_client/startup/__init__.py +0 -0
  26. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_ipython_client/startup/post_startup.py +0 -0
  27. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_ipython_client/startup/pre_startup.py +0 -0
  28. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_widgets/__init__.py +0 -0
  29. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_widgets/auto_updates/__init__.py +0 -0
  30. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_widgets/widgets/ExampleWidgetPlugin/ExampleWidgetPlugin.py +0 -0
  31. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_widgets/widgets/ExampleWidgetPlugin/ExampleWidgetPlugin.ui +0 -0
  32. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_widgets/widgets/ExampleWidgetPlugin/ExampleWidgetPlugin_ui.py +0 -0
  33. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_widgets/widgets/ExampleWidgetPlugin/__init__.py +0 -0
  34. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_widgets/widgets/NoUiWidgetPlugin/NoUiWidgetPlugin.py +0 -0
  35. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_widgets/widgets/NoUiWidgetPlugin/__init__.py +0 -0
  36. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/bec_widgets/widgets/__init__.py +0 -0
  37. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/deployments/__init__.py +0 -0
  38. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/deployments/device_server/__init__.py +0 -0
  39. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/deployments/device_server/startup.py +0 -0
  40. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/device_configs/__init__.py +0 -0
  41. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/devices/__init__.py +0 -0
  42. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/file_writer/__init__.py +0 -0
  43. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/macros/README.md +0 -0
  44. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/macros/__init__.py +0 -0
  45. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/macros/macro_test.py +0 -0
  46. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/scans/__init__.py +0 -0
  47. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/scans/metadata_schema/__init__.py +0 -0
  48. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/scans/metadata_schema/custom_test_scan_schema.py +0 -0
  49. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/scans/metadata_schema/metadata_schema_registry.py +0 -0
  50. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bec_testing_plugin/scans/metadata_schema/metadata_schema_template.py +0 -0
  51. {bec_testing_plugin-0.3.0/bec_testing_plugin/services → bec_testing_plugin-0.3.2/bec_testing_plugin/scans/scan_customization}/__init__.py +0 -0
  52. {bec_testing_plugin-0.3.0 → bec_testing_plugin-0.3.2}/bin/.gitignore +0 -0
@@ -2,7 +2,7 @@
2
2
  # It is needed to track the repo template version, and editing may break things.
3
3
  # This file will be overwritten by copier on template updates.
4
4
 
5
- _commit: v1.2.2
5
+ _commit: v1.4.0
6
6
  _src_path: https://github.com/bec-project/plugin_copier_template.git
7
7
  make_commit: true
8
8
  project_name: bec_testing_plugin
@@ -0,0 +1,70 @@
1
+ name: Create template upgrade PR for bec_testing_plugin
2
+ on:
3
+ workflow_dispatch:
4
+
5
+ permissions:
6
+ pull-requests: write
7
+
8
+ jobs:
9
+ create_update_branch_and_pr:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ pull-requests: write
14
+
15
+ steps:
16
+ - name: Setup Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: '3.12'
20
+
21
+ - name: Checkout
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Create virtualenv
25
+ run: |
26
+ python -m virtualenv .venv
27
+
28
+ - name: Install tools
29
+ run: |
30
+ source .venv/bin/activate
31
+ pip install copier PySide6 bec_lib
32
+
33
+ - name: Perform update
34
+ run: |
35
+ source .venv/bin/activate
36
+ git config --global user.email "bec_ci_staging@psi.ch"
37
+ git config --global user.name "BEC automated CI"
38
+
39
+ branch="chore/update-template-$(python -m uuid)"
40
+ echo "switching to branch $branch"
41
+ git checkout -b $branch
42
+
43
+ echo "Running copier update..."
44
+ copier update --trust --defaults --conflict inline 2>&1 | tee copier.log
45
+ status=${PIPESTATUS[0]}
46
+ output="$(cat copier.log)"
47
+ echo $output
48
+ msg="$(printf '%s\n' "$output" | head -n 1)"
49
+
50
+ if ! grep -q "make_commit: true" .copier-answers.yml ; then
51
+ echo "Autocommit not made, committing..."
52
+ git add -A
53
+ git commit -a -m "$msg"
54
+ fi
55
+
56
+ if diff-index --quiet HEAD ; then
57
+ echo "No changes detected"
58
+ exit 0
59
+ fi
60
+
61
+ git push -u origin $branch
62
+ curl -X POST "https://gitea.psi.ch/api/v1/repos/${{ gitea.repository }}/pulls" \
63
+ -H "Authorization: token ${{ secrets.CI_REPO_WRITE }}" \
64
+ -H "Content-Type: application/json" \
65
+ -d "{
66
+ \"title\": \"Template: $(echo $msg)\",
67
+ \"body\": \"This PR was created by Gitea Actions\",
68
+ \"head\": \"$(echo $branch)\",
69
+ \"base\": \"main\"
70
+ }"
@@ -90,8 +90,13 @@ jobs:
90
90
  uv pip install --system -e ./bec/bec_ipython_client
91
91
  uv pip install --system -e ./bec/bec_server[dev]
92
92
  uv pip install --system -e ./bec_widgets[dev]
93
- uv pip install --system -e ./bec_testing_plugin
93
+ uv pip install --system -e "./bec_testing_plugin[dev]"
94
94
 
95
95
  - name: Run Pytest with Coverage
96
96
  id: coverage
97
- run: pytest --random-order --cov=./bec_testing_plugin --cov-config=./bec_testing_plugin/pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./bec_testing_plugin/tests/ || test $? -eq 5
97
+ run: |
98
+ if coverage run --rcfile=./bec_testing_plugin/pyproject.toml --branch --source=./bec_testing_plugin -m pytest --random-order ./bec_testing_plugin/tests/; then
99
+ coverage xml --rcfile=./bec_testing_plugin/pyproject.toml
100
+ else
101
+ test $? -eq 5
102
+ fi
@@ -1,6 +1,25 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v0.3.2 (2026-09-27)
5
+
6
+ ### Bug Fixes
7
+
8
+ - Migrate plugin scans to v4
9
+ ([`f3c8bac`](https://github.com/bec-project/bec_testing_plugin/commit/f3c8bac246f54987e2e5dedd5030159ff36ff53a))
10
+
11
+ - Use coverage instead of pytest-cov
12
+ ([`c0279ee`](https://github.com/bec-project/bec_testing_plugin/commit/c0279eee3539eb4af32e42675da0e78f45a394fc))
13
+
14
+
15
+ ## v0.3.1 (2026-04-21)
16
+
17
+ ### Bug Fixes
18
+
19
+ - Update bw client to provide import modules
20
+ ([`2dfb145`](https://github.com/bec-project/bec_testing_plugin/commit/2dfb145791f4b42b72179c89f09b96a9c2b4c07f))
21
+
22
+
4
23
  ## v0.3.0 (2025-12-19)
5
24
 
6
25
  ### Features
@@ -1,12 +1,12 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: bec_testing_plugin
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: A plugin repository for BEC
5
5
  License-File: LICENSE
6
6
  Classifier: Development Status :: 3 - Alpha
7
7
  Classifier: Programming Language :: Python :: 3
8
8
  Classifier: Topic :: Scientific/Engineering
9
- Requires-Python: >=3.10
9
+ Requires-Python: >=3.11
10
10
  Provides-Extra: dev
11
11
  Requires-Dist: bec-server; extra == 'dev'
12
12
  Requires-Dist: black; extra == 'dev'
@@ -0,0 +1,61 @@
1
+ # This file was automatically generated by generate_cli.py
2
+ # type: ignore
3
+
4
+ from __future__ import annotations
5
+
6
+ from bec_lib.logger import bec_logger
7
+
8
+ from bec_widgets.cli.rpc.rpc_base import RPCBase, rpc_call, rpc_timeout
9
+
10
+ logger = bec_logger.logger
11
+
12
+ # pylint: skip-file
13
+
14
+
15
+ _Widgets = {}
16
+
17
+
18
+ class Examplewidgetplugin(RPCBase):
19
+ _IMPORT_MODULE = (
20
+ "bec_testing_plugin.bec_widgets.widgets.ExampleWidgetPlugin.ExampleWidgetPlugin"
21
+ )
22
+
23
+ @rpc_call
24
+ def remove(self):
25
+ """
26
+ Cleanup the BECConnector
27
+ """
28
+
29
+ @rpc_call
30
+ def attach(self):
31
+ """
32
+ None
33
+ """
34
+
35
+ @rpc_call
36
+ def detach(self):
37
+ """
38
+ Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget.
39
+ """
40
+
41
+
42
+ class Nouiwidgetplugin(RPCBase):
43
+ _IMPORT_MODULE = "bec_testing_plugin.bec_widgets.widgets.NoUiWidgetPlugin.NoUiWidgetPlugin"
44
+
45
+ @rpc_call
46
+ def remove(self):
47
+ """
48
+ Cleanup the BECConnector
49
+ """
50
+
51
+ @rpc_call
52
+ def attach(self):
53
+ """
54
+ None
55
+ """
56
+
57
+ @rpc_call
58
+ def detach(self):
59
+ """
60
+ Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget.
61
+ """
@@ -1,4 +1,4 @@
1
- from bec_server.scan_server.scans import LineScan
1
+ from bec_server.scan_server.scans.line_scan import LineScan
2
2
 
3
3
 
4
4
  class CustomTestingScan(LineScan):
@@ -0,0 +1,37 @@
1
+ from bec_server.scan_server.scans import position_generators
2
+ from bec_server.scan_server.scans.grid_scan import GridScan, scan_hook
3
+
4
+
5
+ class DeviceProgressScan(GridScan):
6
+ """A scan that simulates device progress updates."""
7
+
8
+ scan_name = "device_progress_grid_scan"
9
+
10
+ @scan_hook
11
+ def prepare_scan(self):
12
+ """
13
+ Prepare the scan. This can include any steps that need to be executed
14
+ before the scan is opened, such as preparing the positions (if not done already)
15
+ or setting up the devices.
16
+ """
17
+ self.positions = position_generators.nd_grid_positions(
18
+ self.motor_input_bundles.values(), snaked=self.snaked
19
+ )
20
+
21
+ if self.relative:
22
+ self.start_positions = self.components.get_start_positions(self.motors)
23
+ self.positions += self.start_positions
24
+
25
+ self.components.check_limits(self.motors, self.positions)
26
+
27
+ self.update_scan_info(
28
+ positions=self.positions,
29
+ num_points=len(self.positions),
30
+ num_monitored_readouts=len(self.positions) * self.burst_at_each_point,
31
+ )
32
+
33
+ self.actions.add_scan_report_instruction_device_progress(device="waveform")
34
+
35
+ self._baseline_readout_status = self.actions.read_baseline_devices(wait=False)
36
+
37
+ self._premove_motor_status = self.actions.set(self.motors, self.positions[0], wait=False)
@@ -0,0 +1,12 @@
1
+ """
2
+ Scan components for bec_testing_plugin.
3
+
4
+ The scan components module allows you to define custom components that can be used in your scans.
5
+ These components can be used to encapsulate reusable logic, interact with devices, or perform specific actions during the scan lifecycle.
6
+ """
7
+
8
+ from bec_server.scan_server.scans.scan_components import ScanComponents
9
+
10
+
11
+ class BecTestingPluginScanComponents(ScanComponents):
12
+ """Scan components for bec_testing_plugin."""
@@ -0,0 +1,31 @@
1
+ """
2
+ Scan modifier plugin for bec_testing_plugin.
3
+
4
+ The scan modifier allows you to modify the scan lifecycle and run custom actions before or after the scan hook or replace the scan hook entirely.
5
+ Note that the scan_modifier module must be registered as a plugin in the pyproject.toml file for it to be recognized by the BEC framework and that
6
+ there can only be one scan_modifier plugin registered at a time. If you need to run multiple scan modifiers, you can create a single scan
7
+ modifier plugin that runs multiple actions in sequence with conditional logic to determine which actions to run based on the scan context.
8
+ """
9
+
10
+ from bec_server.scan_server.scans.scan_modifier import ScanModifier, scan_hook_impl
11
+
12
+
13
+ class BecTestingPluginScanModifier(ScanModifier):
14
+ """
15
+ Scan modifier for bec_testing_plugin.
16
+
17
+ By inheriting from the ScanModifier base class, you get access to currently running scan (self.scan), the devices (self.dev), the scan info (self.scan_info),
18
+ the scan components (self.components) and the scan actions (self.actions).
19
+ """
20
+
21
+ def __init__(self, *args, **kwargs):
22
+ """Initialize the scan modifier."""
23
+ super().__init__(*args, **kwargs)
24
+
25
+ # Example of running code before the scan stage for a specific scan
26
+ # @scan_hook_impl("stage", "before")
27
+ # def before_stage(self):
28
+ # """Run before the stage hook."""
29
+ # self.actions.send_client_info("Custom stage logic executed by ScanModifier.")
30
+ # if self.scan_info.scan_name == "example_scan":
31
+ # self.dev.samx.set(20)
@@ -4,9 +4,9 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_testing_plugin"
7
- version = "0.3.0"
7
+ version = "0.3.2"
8
8
  description = "A plugin repository for BEC"
9
- requires-python = ">=3.10"
9
+ requires-python = ">=3.11"
10
10
  classifiers = [
11
11
  "Development Status :: 3 - Alpha",
12
12
  "Programming Language :: Python :: 3",
@@ -39,6 +39,9 @@ plugin_file_writer = "bec_testing_plugin.file_writer"
39
39
  [project.entry-points."bec.scans"]
40
40
  plugin_scans = "bec_testing_plugin.scans"
41
41
 
42
+ [project.entry-points."bec.scans.scan_modifier"]
43
+ plugin_scan_modifier = "bec_testing_plugin.scans.scan_customization.scan_modifier"
44
+
42
45
  [project.entry-points."bec.scans.metadata_schema"]
43
46
  plugin_metadata_schema = "bec_testing_plugin.scans.metadata_schema"
44
47
 
@@ -1,7 +0,0 @@
1
- include:
2
- - file: /templates/plugin-repo-template.yml
3
- inputs:
4
- name: bec_testing_plugin
5
- target: bec_testing_plugin
6
- branch: $CHILD_PIPELINE_BRANCH
7
- project: bec/awi_utils
@@ -1,31 +0,0 @@
1
- # This file was automatically generated by generate_cli.py
2
- # type: ignore
3
-
4
- from __future__ import annotations
5
-
6
- from bec_lib.logger import bec_logger
7
-
8
- from bec_widgets.cli.rpc.rpc_base import RPCBase, rpc_call
9
-
10
- logger = bec_logger.logger
11
-
12
- # pylint: skip-file
13
-
14
-
15
- _Widgets = {}
16
-
17
-
18
- class Examplewidgetplugin(RPCBase):
19
- @rpc_call
20
- def remove(self):
21
- """
22
- Cleanup the BECConnector
23
- """
24
-
25
-
26
- class Nouiwidgetplugin(RPCBase):
27
- @rpc_call
28
- def remove(self):
29
- """
30
- Cleanup the BECConnector
31
- """
@@ -1,10 +0,0 @@
1
- from bec_server.scan_server.scans import Scan
2
-
3
-
4
- class DeviceProgressScan(Scan):
5
- """A scan that simulates device progress updates."""
6
-
7
- scan_name = "device_progress_grid_scan"
8
-
9
- def scan_report_instructions(self):
10
- yield from self.stubs.scan_report_instruction({"device_progress": ["waveform"]})