BCDA-APS / bluesky_training

Bluesky training, including instrument package
https://bcda-aps.github.io/bluesky_training/
Other
11 stars 0 forks source link

add haven to new instrument environments #184

Closed prjemian closed 9 months ago

prjemian commented 1 year ago

Add the haven package to new instrument environments. See #116 for details.

prjemian commented 10 months ago

But haven requires python<3.11:

(bluesky_2023_2) zorinvm@zorin22:~/.../bluesky/environments$ pip install haven-spc
DEPRECATION: Loading egg at /home/zorinvm/Apps/miniconda/envs/bluesky_2023_2/lib/python3.11/site-packages/stdlogpj-1.0.3-py3.7.egg is deprecated. pip 23.3 will enforce this behaviour change. A possible replacement is to use pip for package installation..
ERROR: Ignored the following versions that require a different python version: 0.1.0 Requires-Python <3.11,>=3.7; 23.7.1 Requires-Python <3.11,>=3.7
ERROR: Could not find a version that satisfies the requirement haven-spc (from versions: none)
ERROR: No matching distribution found for haven-spc
prjemian commented 10 months ago

Needs more thought.

prjemian commented 10 months ago

An alternative to adding the haven-spc package (and its requirement of py <3.11) is vendoring its InstrumentRegistry support.

@canismarko -- Thoughts? Can the requirement be relaxed?

canismarko commented 10 months ago

Unfortunately, Haven is stuck on python 3.9 until this pydm issue gets resolved: https://github.com/slaclab/pydm/issues/951

I could allow python 3.11, but I can't run tests on CI due to the above-mentioned issue, so I'd rather not.

I re-factored the instrument registry so that it has no other Haven dependencies, so vendoring it might be the best choice for now.

https://github.com/spc-group/haven/commit/4e066d644c447dff5d57b5e3a10495b631139492

prjemian commented 10 months ago

Understood. Thanks, @canismarko !

canismarko commented 10 months ago

I spun-off the instrument registry into a separate package for python 3.7 to 3.11. It's live now on pypi (pip install ophyd-registry). I plan on making some upgrades in the near future, most notably so that you don't need to explicitly register the devices. E.g.

from ophydregistry import Registry
registry = Registry()

the_device = MyDevice("255id:Dev:", name="my_device")

assert registry.find("my_device") is the_device

Other options (as a decorator):

from ophydregistry import Registry
registry = Registry()

@registry.register
class MyDevice():
    ...
prjemian commented 10 months ago

How to register any device (created after this config step, that is) that uses a specific class?

prjemian commented 10 months ago

Thanks, you updated the comment above.