ju
functionality demos
#4
thorwhalen
started this conversation in
General
Replies: 1 comment
-
Visualizing your models as a graphfrom ju.viz import model_digraph
from pydantic import BaseModel
from typing import List, Optional
class Address(BaseModel):
street: str
city: str
state: str
class User(BaseModel):
name: str
email: str
age: Optional[int] = None
addresses: List[Address]
class SomethingElse(BaseModel):
a: int
b: str
dot = model_digraph([User, SomethingElse])
## to output in a file and get the path to it:
# dot.render('model_diagram', format='png', cleanup=True)
# to get the Digraph object (if last line, will display in jupyter)
dot TODOs:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A demo of
ju
functionalities.Beta Was this translation helpful? Give feedback.
All reactions