pcdshub / pcdshub/hutch-python

User loads should happen serially

Open
#168 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1
Forks
18
Avg merge
7d 9h
Merged PRs (30d)
1

Description

Expected Behavior

This conf entry should make user devices loaded in previous lines available in future lines:

load:
    hutch.beamline
    hutch.scripts_with_beamline_devices

e.g. so we can do from hutch.db import beamline_device in the script, same as the API we provided to extract devices from happi.

Current Behavior

There isn't any way to define devices in one file and reference them in another loaded file. This hasn't been a problem for MFX but that's because everything is loaded in happi instead of in beamline.py, but this is not realistic SOP for everything we'd want to do.

Possible Solution

Fix these lines so that we import and stash devices between user module loads instead of once at the end:
https://github.com/pcdshub/hutch-python/blob/0a5e4ddcb7d5b6e7da4e075a035c5378c82bf82c/hutch_python/load_conf.py#L269-L271

Context

asc las lab doesn't have a happi db and shouldn't need to define one to make the stuff work

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the load and device-stashing logic at hutch_python/load_conf.py lines 269-271, then inspect how the example configuration loads hutch.beamline and hutch.scripts_with_beamline_devices. Verify that devices loaded in an earlier user module can be imported by a later module without requiring a happi database.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.