WikibaseIntegrator icon indicating copy to clipboard operation
WikibaseIntegrator copied to clipboard

Use pydantic?

Open dpriskorn opened this issue 3 years ago • 3 comments

"Data validation and settings management using python type annotations.

pydantic enforces type hints at runtime, and provides user friendly errors when data is invalid.

Define how data should be in pure, canonical python; validate it with pydantic."

https://pydantic-docs.helpmanual.io/

dpriskorn avatar Jan 26 '22 23:01 dpriskorn

https://medium.com/swlh/cool-things-you-can-do-with-pydantic-fc1c948fbde0#f078 is a good introduction, I just implemented it in asseeibot and it was some work, but it seems to be worth it :)

dpriskorn avatar Jan 27 '22 23:01 dpriskorn

I ran into this error after adding pydantic in https://github.com/dpriskorn/WikibaseIntegrator/tree/pydantic-test bild I searched the interwebbs but did not find anything about this issue. Might be an issue in pydantic?

dpriskorn avatar Feb 11 '22 10:02 dpriskorn

Unfortunately pydantic does not seem to support private variables and setters. See https://stackoverflow.com/questions/69152143/private-attributes-in-pydantic

Should we close this and so our own validation instead?

dpriskorn avatar Feb 16 '22 12:02 dpriskorn