mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-09-07 00:42:37 +02:00
Lets the graph be built and fetched before any release carries it, so the self-update path can be exercised end to end. Also stamps the PR head commit rather than the merge commit, which exists in no local clone and would make every staleness check report an invalid revision range. Dry-run only — drop this commit before merging.
3.2 KiB
3.2 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. - If
graphify-out/exists, route through it before grepping —graphify query/path/explain/affectedanswer "what talks to what" faster than a repo-wide search. It is optional and gitignored; if it is missing, just work from the code. Before trusting a downloaded map, check it against the checkout — not the installed package, which can lag — with thegit rev-list --countsnippet inAGENTS.md. Anything but0means the map is behind your working tree: say so and verify against the code instead of answering from the graph. - TEMPORARY (dropped before merge): if
graphify-out/is missing or that check is not0, fetch the map yourself from this pull request's workflow artifact — see TEMPORARY — fetch the map from this pull request's build inAGENTS.md. Do it without asking, and report the staleness number you got before using the map. - 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.