Document convention on Enum key-value naming
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start by tracing how PVI enum signals are generated from AttrRW and EnumHandler, using the DetectorStatus and TriggerMode examples in the issue. Reproduce the mismatch between enum keys and values, then verify that generated PVI choices use the enum values described in the acceptance criteria.
Written by the indexing model from the issue text.
Description
See Tom's example here: https://github.com/DiamondLightSource/FastCS/issues/175#issuecomment-3197183789
If I create an attribute which uses an Enum that I've created, for example:
class DetectorStatus(enum.StrEnum):
IDLE = "Idle"
ERROR = "Error"
WAITING = "Waiting"
RUN_FINISHED = "Run Finished"
TRANSMITTING = "Transmitting"
RUNNING = "Running"
STOPPED = "Stopped"
and then
trigger_mode = AttrRW(
Enum(TriggerMode),
handler=EnumHandler(TRIGGER_MODE_ENUM_MAPPING, TriggerMode, "timing"),
group=MY_GROUP,
)
and then my client (ophyd-async) uses PVI to see what choices this enum can have, it lists the keys of these enums rather than its values. For example, when I try to connect to this device using the following enum in ophyd-async,
class DetectorStatus(StrictEnum):
IDLE = "Idle"
ERROR = "Error"
WAITING = "Waiting"
RUN_FINISHED = "Run Finished"
TRANSMITTING = "Transmitting"
RUNNING = "Running"
STOPPED = "Stopped"
ophyd-async gives the following error
TypeError: LAB29-JUNGFRAU:DetectorStatus has choices ('Idle', 'Error', 'Waiting', 'RunFinished', 'Transmitting', 'Running', 'Stopped'), but <enum 'DetectorStatus'> requested ['IDLE', 'ERROR', 'WAITING', 'RUN_FINISHED', 'TRANSMITTING', 'RUNNING', 'STOPPED'] to be strictly equal to them.
I would have expected the choices to be the Enum values rather than the keys
Acceptance Criteria
- FastCS creates PVI for enum signals using the enum values
- Dominant language
- Python
- Stars
- 6
- Forks
- 8
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DiamondLightSource/fastcs
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/fastcs#416 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
DiamondLightSource/fastcs#345 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 62/100
DiamondLightSource/fastcs#341 ·
-
decision
Difficulty 5/5 Over a week Newbie friendliness 25/100
DiamondLightSource/fastcs#428 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
DiamondLightSource/fastcs#422 · 1 comment ·
All issues in DiamondLightSource/fastcs
Similar issues
-
triage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100