mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-09-04 15:50:43 +02:00
2.3 KiB
2.3 KiB
CLAUDE.md — bec_widgets
@AGENTS.md
The guidelines above are imported from AGENTS.md (single source of
truth). The points that matter most in day-to-day work:
- Check for
AGENTS_PERSONAL.mdfirst. If it exists, it extendsAGENTS.mdwith machine-specific environment setup and takes precedence over the generic venv/pip instructions there. It is untracked and personal — never commit it, and never assume it exists. - Import from
qtpy, neverPySide6.*. CI greps forfrom PySide6.and fails the build (onlyPySide6.QtDesignerandPySide6.scriptsare exempt). bec_widgets/cli/client.pyand the Designer plugin files are generated — never hand-edit them. Regenerate withbw-generate-cli --target bec_widgetswhenever a widget's RPC API changes (USER_ACCESSentries or an exposed signature) or a new widget with RPC access or a Qt Designer plugin is added; CI runs the same command andgit diff --exit-code. For a beamline plugin repo,--targetis that repository's importable package name (bw-generate-cli --target my_plugin_repo).- Widget pattern: inherit
BECWidgetfirst, then the Qt class; declareUSER_ACCESS; subscribe viaBECDispatcher+MessageEndpoints; decorate slots with@SafeSlot; reach BEC throughself.get_bec_shortcuts(). Disconnect subscriptions and stop timers incleanup(), and never block the Qt event loop. - Tests:
python -m pytest --random-order tests/unit_tests/. Build widgets withcreate_widget(qtbot, WidgetClass, ...)fromtests/unit_tests/conftest.pysoqtbotowns teardown; reuseFakeDevice/FakePositioner/DMMockfrombec_widgets/tests/utils.py. Headless runs needQT_QPA_PLATFORM=offscreen. - Format before finishing:
black --line-length=100 --skip-magic-trailing-comma .andisort --line-length=100 --profile=black --multi-line=3 --trailing-comma .. - Beamline-specific widgets belong in a plugin repo, discovered via the
bec.widgets.user_widgetsentry-point group — not in this repository. - Do not commit or push unless explicitly asked, and never open a pull request. If you do commit, write a single Conventional Commits line — it is parsed into the published changelog. Opening the PR is the human's step; leave them the summary, test output, and a screenshot or GIF of any visible GUI change.