Add keyword classes and keys.list/describe services#13
Merged
mikelangmayr merged 2 commits intomainfrom Apr 27, 2026
Merged
Conversation
Collaborator
mikelangmayr
commented
Apr 24, 2026
- add Keyword class to libby
- add keyword types (bool, int, float, string, trigger)
- update README
prkrtg
reviewed
Apr 27, 2026
Collaborator
There was a problem hiding this comment.
I think this makes it
FloatKeyword(f"positionvalue{s}",
getter=lambda: self.controller.get_pos(self.device_key, self.axis),
setter=self._set_position,
validator=self._check_soft_limits,
units=self.units,
description="Stage position in engineering units."),
What about making a builder object?
from libby import (
FloatKeyword
)
class KeywordBuilder:
def __init__(self, daemon):
self._daemon = daemon
self._keywords = []
def _add(self, kw):
self._keywords.append(kw)
return kw
def float(self, name, *, get=None, set=None, units=None,
description="", nullable=False, validator=None):
return self._add(
FloatKeyword(
name,
getter=get,
setter=set,
units=units,
description=description,
nullable=nullable,
validator=validator,
)
)
Then in Hispec
class HispecDaemon:
def __init__(self):
self.keywords = KeywordBuilder(self)
def on_start(self, _libby):
self.keywords.float(
"position",
get=lambda: self.controller.get_pos(...),
set=self._set_position,
units="mm",
description="Stage position",
)
prkrtg
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.