jmosbacher / pydantic-panel

Edit pydantic models with widgets from the awesome Panel package
MIT License
24 stars 3 forks source link

Discussion: Should the scope be broadened to Param? #7

Open MarcSkovMadsen opened 2 years ago

MarcSkovMadsen commented 2 years ago

Currently the scope is Panel and the Pydanticpane. That might be all that is needed.

Theoretically though, I believe the "right" thing to do would be to implement conversions from Pydantic to Param models and back. That would enable Param/ HoloViz users to tap broader into the Pydantic ecosystem and Pydantic users to tap more into the wider HoloViz ecosystem. But it is a larger task and might also be harder to document and support.

A proof of concept can be found here https://github.com/MarcSkovMadsen/paithon/pull/1

I believe the current api could be extended to support the wider scope some day when and if. But the pydantic-panel name would maybe not be the right name?

jmosbacher commented 2 years ago

Do you mean converting between Pydantic(BasePane) and Param(BasePane) in panel or are you talking about converting the actual BaseModel classes to param.Parameterized classes like you do in your POC?

MarcSkovMadsen commented 2 years ago

The latter. Like I do in my POC.

jmosbacher commented 2 years ago

I dont see how one would benefit from that. My first attempt was designed this way but I quickly realized that I am not gaining anything from the conversion. I have all the code for such games, similar to what you did with some extra syncing and validation tricks but in the end it felt very unnatural and unnecessarily complex.

pydantic is very class-oriented, where param is very instance oriented. I dont think their features really map on to each other.