bluesky / event-model

data model for event-based data collection and analysis
https://blueskyproject.io/event-model
BSD 3-Clause "New" or "Revised" License
15 stars 31 forks source link

Issues with pydantic v2 #280

Closed DominicOram closed 1 year ago

DominicOram commented 1 year ago

Despite https://github.com/bluesky/event-model/commit/5abfa586b09897d86c1b709dd2926edf9f87b634 pinning the pydantic version in dev there are still potential issues with pydantic.

Expected Behavior

I should be able to do the following in my application that uses bluesky and pydantic:

pip install bluesky
pip install pydantic
python
>>> from bluesky.run_engine import RunEngine

Current Behavior

The above will throw an exception.

Possible Solution

The issue is that because the pin is in dev pip does not realise that bluesky requires the pin so installs the latest pydantic. The import check in https://github.com/bluesky/event-model/blob/main/event_model/documents/generate/type_wrapper.py then picks up the v2. Possible fixes are:

  1. Update event-model to work for v2 (probably prefered)
  2. Update the import check to also check the version (quicker but dirtier)