[WIP] Extended YAML support#162
Conversation
2 similar comments
scasagrande
left a comment
There was a problem hiding this comment.
This is a fantastic starting point! LOVE IT
A few minor things I saw while riding the bus are noted.
Should we take this opportunity to upgrade from pyyaml to something still being developed? I know you sent me the link to another project, but I don't have it on hand at the moment...
Also, could you switch the merge target to develop, thanks :)
|
|
||
| inst_dict = {} | ||
| for name, value in conf_dict.iteritems(): | ||
| for name, value in conf_dict.items(): |
| the form | ||
| ``{'ddg': instruments.srs.SRSDG645.open_from_uri('gpib+usb://COM7/15')}``. | ||
|
|
||
| Optionally, each the value of each instrument key can also contain a dictionary |
There was a problem hiding this comment.
Good point, I'll improve that, then.
| rot_stage: | ||
| class: !!python/name:instruments.thorabsapt.APTMotorController | ||
| uri: serial:///dev/ttyUSB0?baud=115200 | ||
| attrs: |
|
|
||
| # pylint: disable=protected-access,missing-docstring | ||
|
|
||
| @skipIf(yaml is None, "PyYAML is not installed.") |
There was a problem hiding this comment.
I don't think we should be skipping tests if pyyaml is missing. I can see the situation where it fails to install in CI (for whatever reason) and simultaneously there is a bug that these tests would reveal. Build would be green, even though some tests technically fail.
There was a problem hiding this comment.
Fair point, I'll make sure YAML (whichever once we go with) is appropriately a dependency for the test environment, then. I think now that the conda command depends on rumel.yaml, it's not as heavy of a dependency as it used to be.
|
Thanks, I'm glad you like! Thanks as well for the feedback, I'll go on and fix that stuff up, then. (Sorry about the wrong target for the PR, I always forget to change from the GitHub default... have they introduced a setting to control that yet? Will close PR and retarget.) |
This PR (still work in progress) adds to existing YAML config-file support by updating it for Py3 and by allowing config files to specify attributes to be set on newly-created instruments. This is useful, for instance, in the case of ThorLabs APT motor controller devices, where the model of each attached motor must be manually specified. Since this is a fairly significant set of changes, I wanted to open the PR in advance of writing tests and better documentation so as to get feedback on the design.
In particular, this PR adds the following functionality:
test://instrument URI schema to make it easier to test config support in lieu of actual devices.!Qtag.attrsconfig sections of the following form:DeprecationWarning).I intend on adding the following to the PR:
test://URI, andattrsconfig sections.