feat: add support for aarebec #43

Merged
perl_d merged 2 commits from feat/aare_bec into main 2026-11-26 09:24:11 +01:00
6 changed files with 143 additions and 2 deletions

No files matched your search

+34 -2
View File
@@ -1,6 +1,7 @@
name: CI for pxiii_bec
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
inputs:
@@ -24,6 +25,11 @@ on:
required: false
type: string
default: "main"
MX_BEC_REPO_BRANCH:
description: "Branch of the mx_bec core repo to install"
required: false
type: string
default: "main"
PYTHON_VERSION:
description: "Python version to use"
required: false
@@ -46,6 +52,29 @@ jobs:
with:
python-version: "${{ inputs.PYTHON_VERSION || '3.12' }}"
# Use the same-named branch of mx_bec if it exists (e.g. a feature developed in both repos), otherwise main.
- name: Resolve mx_bec branch
id: mx_bec
shell: bash
run: |
ref="${{ inputs.MX_BEC_REPO_BRANCH || github.head_ref || github.ref_name }}"
auth="$(printf 'x-access-token:%s' '${{ github.token }}' | base64 -w0)"
if git -c "http.extraheader=Authorization: Basic ${auth}" ls-remote --exit-code --heads \
"${{ github.server_url }}/bec/mx_bec.git" "refs/heads/${ref}" >/dev/null; then
echo "Using mx_bec branch '${ref}'"
else
echo "mx_bec has no branch '${ref}', using main"
ref=main
fi
echo "ref=${ref}" >> "$GITHUB_OUTPUT"
- name: Checkout MX BEC Repository
uses: actions/checkout@v4
with:
repository: bec/mx_bec
ref: "${{ steps.mx_bec.outputs.ref }}"
path: ./mx_bec
- name: Checkout BEC Plugin Repository
uses: actions/checkout@v4
with:
@@ -94,8 +123,11 @@ jobs:
uv pip install --system -e ./bec/bec_lib[dev]
uv pip install --system -e ./bec/bec_ipython_client
uv pip install --system -e ./bec/bec_server[dev]
uv pip install --system -e ./bec_widgets[dev,pyside6]
uv pip install --system -e ./pxiii_bec[dev]
uv pip install --system -e ./bec_widgets[dev]
# mx_bec pins its MX-internal dependencies (aarecommon, aare_config, ...) as direct URLs
# to the gitea registry. uv only accepts URL dependencies from packages named on the
# command line, so mx_bec must be installed together with the plugin which depends on it.
uv pip install --system -e ./mx_bec[dev] -e ./pxiii_bec[dev]
- name: Run Tests with Coverage
id: coverage
@@ -0,0 +1,5 @@
from mx_bec.bec_widgets.widgets.aare_bec.actors_config import MxActorConfigWidget
from mx_bec.bec_widgets.widgets.aare_bec.task_panel import MxTaskPanel
from mx_bec.bec_widgets.widgets.aare_bec.task_queue import MxTaskQueueWidget
__all__ = ["MxActorConfigWidget", "MxTaskPanel", "MxTaskQueueWidget"]
+85
View File
@@ -13,10 +13,95 @@ logger = bec_logger.logger
_Widgets = {
"PxIIIActorConfigWidget": "PxIIIActorConfigWidget",
"PxIIISampleQueueWidget": "PxIIISampleQueueWidget",
"PxIIISpreadsheetDisplay": "PxIIISpreadsheetDisplay",
"PxIIITaskPanel": "PxIIITaskPanel",
"PxIIITaskQueueWidget": "PxIIITaskQueueWidget",
"ScanHistory": "ScanHistory",
}
class PxIIIActorConfigWidget(RPCBase):
_IMPORT_MODULE = "pxiii_bec.bec_widgets.widgets.imported"
@rpc_call
def refresh(self):
"""
Reset the layout for currently loaded actors
"""
class PxIIISampleQueueWidget(RPCBase):
_IMPORT_MODULE = "pxiii_bec.bec_widgets.widgets.imported"
@rpc_call
def refresh(self):
"""
Reload the queued samples from Redis.
"""
@rpc_call
def clear_queue(self):
"""
Delete the queue contents
"""
class PxIIISpreadsheetDisplay(RPCBase):
_IMPORT_MODULE = "pxiii_bec.bec_widgets.widgets.imported"
@rpc_call
def remove(self):
"""
Cleanup the BECConnector
"""
@rpc_call
def attach(self):
"""
None
"""
@rpc_call
def detach(self):
"""
Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget.
"""
class PxIIITaskPanel(RPCBase):
_IMPORT_MODULE = "pxiii_bec.bec_widgets.widgets.imported"
@rpc_call
def request_task(self, name: "str", *args, **kwargs):
"""
Submit a task request to the AareBec service.
"""
class PxIIITaskQueueWidget(RPCBase):
_IMPORT_MODULE = "pxiii_bec.bec_widgets.widgets.imported"
@rpc_call
def refresh(self):
"""
Reload the queued tasks from Redis.
"""
@rpc_call
def clear_queue(self):
"""
Delete the queue contents
"""
@rpc_call
def start_queue(self):
"""
Try to start the queue
"""
class ScanHistory(RPCBase):
_IMPORT_MODULE = "pxiii_bec.bec_widgets.widgets.scan_history.scan_history"
@@ -5,9 +5,22 @@ from __future__ import annotations
# pylint: skip-file
designer_plugins = {
"PxIIIActorConfigWidget": ("pxiii_bec.bec_widgets.widgets.imported", "PxIIIActorConfigWidget"),
"PxIIISampleQueueWidget": ("pxiii_bec.bec_widgets.widgets.imported", "PxIIISampleQueueWidget"),
"PxIIISpreadsheetDisplay": (
"pxiii_bec.bec_widgets.widgets.imported",
"PxIIISpreadsheetDisplay",
),
"PxIIITaskPanel": ("pxiii_bec.bec_widgets.widgets.imported", "PxIIITaskPanel"),
"PxIIITaskQueueWidget": ("pxiii_bec.bec_widgets.widgets.imported", "PxIIITaskQueueWidget"),
"ScanHistory": ("pxiii_bec.bec_widgets.widgets.scan_history.scan_history", "ScanHistory"),
}
widget_icons = {
"PxIIIActorConfigWidget": "format_list_bulleted",
"PxIIISampleQueueWidget": "pending_actions",
"PxIIISpreadsheetDisplay": "format_list_bulleted",
"PxIIITaskPanel": "play_arrow",
"PxIIITaskQueueWidget": "pending_actions",
"ScanHistory": "widgets",
}
+2
View File
@@ -7,6 +7,8 @@ Ophyd devices for the PX III beamline, including the MX specific Aerotech A3200
from mx_bec.devices.beam_profile import CentroidBeamProfile, GaussianBeamProfile
from mx_bec.devices.beam_steering import BeamSteerer
from mx_bec.devices.sim_sample_changer import SimSampleChanger
from mx_bec.devices.sim_stages import SimAerotechStage, SimGoniometer
from .A3200 import AerotechAbrStage
from .A3200utils import A3200Axis
+4
View File
@@ -13,6 +13,7 @@ classifiers = [
"Topic :: Scientific/Engineering",
]
dependencies = [
"mx_bec",
"bec_ipython_client",
"bec_lib",
"bec_server",
@@ -70,6 +71,9 @@ plugin_widgets_update = "pxiii_bec.bec_widgets.auto_updates"
[project.entry-points."bec.widgets.user_widgets"]
plugin_widgets = "pxiii_bec.bec_widgets.widgets"
[project.entry-points."bec.messages"]
plugin_messages = "pxiii_bec.messages"
[tool.hatch.build.targets.wheel]
include = ["*"]