DiamondLightSource / DiamondLightSource/python-copier-template

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

Ouverte
#316 0 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
Jinja
Étoiles
25
Forks
10
Merge moyen
4 h 4 min
PR mergées (30 j)
6

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start by comparing the tagged-union approaches used by scanspec, FastCS, pvi, ibek, and blueapi, with the proposed pydantic v3 changes in mind. Done means the projects have an agreed common BaseModel approach and that method is documented here, including the relevant trade-offs.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
developer-experience, documentation
Type d'issue
Documentation
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.