-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using dataclass_transforms to support attrs, pydantic, etc. #26
Comments
thank you @mcgfeller for pointing out this PEP. So just to make sure I understood the purpose of your message correctly: are you encouraging me to follow the status of this PEP so that I can implement UML documentation from any solution that follows the dataclass-transforms convention? Or had you other ideas in mind? |
and do you have any ideas about how this specification evolve? The changelog stopped a year ago. |
Dear @lucsorel - exactly: If you ever wanted to support Pydantic or attrs as an alternative to dataclasses as the source for the UML documentation, following these specs may be the easiest way. Very few changes might be required; in fact, I already get quite nice results from using py2puml on Pydantic models. The specs were already adopted in Pydantic release v1.9.0 (2021-12-31) and attrs 21.1.0 (2021-05-06). It is supported by Pyright; hence Pylance and VS Code provide type checking and code completion for these alternatives to dataclasses. I just realized it is also officially PEP 681. |
Hi both, great to see that there is already a topic for this. To add some more info as well as a related but different request for ORM support:
Has there been any previous work or thoughts on adding SQLAlchemy support? @lucsorel |
There has been no previous work or thoughts about supporting SQLAlchemy classes, only because I have not used this framework and nobody asked for them 😃 So the topic is open: my initial goal with A first step towards supporting SQLAlchemy would be to create a fake business domain model to support, with the different kinds of relationships between the classes (1-1 composition, 1-n association, inheritance maybe, etc.). I have no idea about how a SQLAlchemy domain model is designed, so doing that for me with code snippets would help. Maybe in a separate issue dedicated to SQLAlchemy? What do you think? |
@lucsorel Great to hear. Much value to be added then :). A separate issue might indeed be best suited, I'll create one. |
Hi - interesting project. UML is currently underestimate, IMO it gives great overviews.
I just wanted to point out to dataclass transforms - I believe it would allow to treat Pydantic, attrs, or Django models like dataclasses with little additional coding.
The text was updated successfully, but these errors were encountered: