DiamondLightSource / DiamondLightSource/mx-bluesky
Use importlib.resources once python<3.12 support is dropped
- Dominant language
- Python
- Stars
- 4
- Forks
- 5
- Avg merge
- 1d 30m
- Merged PRs (30d)
- 2
Description
The latest ophyd-async `load` plan requires a directory (`Path` or `String` type), but the `importlib.resources` only added support to represent a traversable as a directory as of python 3.12 (see https://docs.python.org/3/library/importlib.resources.html). I had to use some old-fashioned Python to get the correct directory path instead, see https://github.com/DiamondLightSource/mx-bluesky/pull/770.
Once Python<3.12 is dropped, we should use `importlib.resources` to get directory locations rather than using
`ROOT_DIR = os.path.dirname(os.path.abspath(__file__))`
## Acceptance Criteria
- Support for python<3.12 is dropped in `mx-bluesky`
- The `ROOT_DIR` constant in `definitions.py` is removed and we use `importlib.resources.as_file` in its place
Contributor guide
Assessment
This issue has not been assessed yet.