Provide stubs/annotations for RecordWrapper
Currently there's no way for a user to know what EPICS record attributes are accessible on a RecordWrapper without just trying to get the attribute - and only a small handful are accessible at the moment. This would also help static type checkers such as mypy to better reason about the values retrieved from the record.
A basic introduction to stubs can be found here: https://mypy.readthedocs.io/en/stable/stubs.html
To act as a starting point, here's a list of things I would like to have type hinting for. These are all in active use in my current project.
For RecordWrapper:
-
add_aliasmethod - just the one string parameter (and documenting it requires the record prefix) -
nameattribute (I use this one a lot) -
set, whose signature varies based on whether the record is In or Out, and based on the type of the record -
set_alarmmethod, only available on In records. -
getmethod, although the type this returns may be very difficult to work out
It may be useful to create InRecordWrapper and OutRecordWrapper types as well - these would help with typing to clearly show the different methods and signatures between the two. This would also serve as a fix to #52 , as all I really needed from that issue was to know whether it was an In or Out record so I knew which signature to use.
Under builder.records:
- The
bi/stringoutetc. methods for creating records could have at least minimal hinting, the record name field, although documenting all possible EPICS keywords would be a chore.