Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python

Hướng nghiên cứu

Bắt đầu bằng cách so sánh các cách tiếp cận tagged union được scanspec, FastCS, pvi, ibek và blueapi sử dụng, đồng thời lưu ý đến các thay đổi được đề xuất trong pydantic v3. Công việc được xem là hoàn tất khi các dự án đã thống nhất một cách tiếp cận BaseModel chung và phương pháp đó được ghi lại ở đây, bao gồm các đánh đổi liên quan.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

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

Ngôn ngữ chính
Jinja
Star
25
Fork
10
Merge trung bình
4 ngày 17 giờ
Pull request đã merge (30 ngày)
7

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

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DiamondLightSource/python-copier-template

Tất cả issue của DiamondLightSource/python-copier-template

Issue tương tự

Thêm issue về DevTools

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.