Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide stubs/annotations for RecordWrapper #54

Open
AlexanderWells-diamond opened this issue Oct 13, 2021 · 1 comment
Open

Provide stubs/annotations for RecordWrapper #54

AlexanderWells-diamond opened this issue Oct 13, 2021 · 1 comment

Comments

@AlexanderWells-diamond
Copy link
Collaborator

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

@AlexanderWells-diamond
Copy link
Collaborator Author

AlexanderWells-diamond commented Oct 13, 2021

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_alias method - just the one string parameter (and documenting it requires the record prefix)
  • name attribute (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_alarm method, only available on In records.
  • get method, 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/stringout etc. methods for creating records could have at least minimal hinting, the record name field, although documenting all possible EPICS keywords would be a chore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant