DiamondLightSource / DiamondLightSource/python-copier-template

Decide on a pydantic v3 BaseModel tagged union method and document it here

Đang mở
#316 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Jinja
Star
25
Fork
10
Merge trung bình
4 giờ 4 phút
Pull request đã merge (30 ngày)
6

Mô tả

At the moment we have multiple ways of using pydantic and tagged unions:
- `scanspec` using pydantic dataclasses and a decorator to make a tagged union of subclasses, it requires positional args
- `FastCS` using plain dataclasses and a pydantic BaseModel creation function to do serialization and deserialization
- `pvi` uses an explicitly created union of BaseModels
- `ibek` uses automatically created Entity BaseModels from EntityModel instances
- `blueapi` does something with BaseModels too, but I can't remember what

With the advent of pydantic v3, now would be a good time to look at investigating a common approach for all these usecases. Standardising on BaseModel instances would probably give us the most tool support for things like documenting models in sphinx, FastAPI and GraphQL support, and downstream serialization

@GDYendell @gilesknap @DiamondJoseph @tpoliaw @abbiemery FYI

@hyperrealist I'm hoping you'll take this on at some point in the new year

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.