The Overview page for Pydantic offers the following Rationale 
<https://pydantic-docs.helpmanual.io/#rationale>, which makes me think that 
it might be of interest to Leo's users and Leo's developers: 

«So *pydantic* uses some cool new language features, but why should I 
actually go and use it?

*plays nicely with your IDE/linter/brain *There's no new schema definition 
micro-language to learn. If you know how to use python type hints, you know 
how to use *pydantic*. Data structures are just instances of classes you 
define with type annotations, so auto-completion, linting, mypy 
<https://pydantic-docs.helpmanual.io/usage/mypy/>, IDEs (especially PyCharm 
<https://pydantic-docs.helpmanual.io/pycharm_plugin/>), and your intuition 
should all work properly with your validated data.

*dual use **pydantic's* BaseSettings 
<https://pydantic-docs.helpmanual.io/usage/settings/> class allows 
*pydantic* to be used in both a "validate this request data" context and in 
a "load my system settings" context. The main differences are that system 
settings can be read from environment variables, and more complex objects 
like DSNs and python objects are often required.*fast *In benchmarks 
<https://pydantic-docs.helpmanual.io/benchmarks/> *pydantic* is faster than 
all other tested libraries.

*validate complex structures *use of recursive *pydantic* models 
<https://pydantic-docs.helpmanual.io/usage/models/#recursive-models>
, typing's standard types 
<https://pydantic-docs.helpmanual.io/usage/types/#standard-library-types> (e.g. 
List, Tuple, Dictetc.) 
and validators <https://pydantic-docs.helpmanual.io/usage/validators/> allow 
complex data schemas to be clearly and easily defined, validated, and 
parsed.

*extensible**pydantic* allows custom data types 
<https://pydantic-docs.helpmanual.io/usage/types/#custom-data-types> to be 
defined or you can extend validation with methods on a model decorated with 
the validator <https://pydantic-docs.helpmanual.io/usage/validators/>
 decorator.

*dataclasses integration *As well as BaseModel, *pydantic* provides a 
dataclass <https://pydantic-docs.helpmanual.io/usage/dataclasses/> decorator 
which creates (almost) vanilla python dataclasses with input data parsing 
and validation.»

>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/7e3ea30e-b0b3-45e7-ba43-930b4ed1a5c2n%40googlegroups.com.

Reply via email to