glances icon indicating copy to clipboard operation
glances copied to clipboard

Use Pydantic as Data Validator / Storage

Open nicolargo opened this issue 3 years ago • 3 comments

See: https://pydantic-docs.helpmanual.io/usage/models/ also have a look on: https://github.com/jcrist/msgspec

Need Python 3.7 or higher.

Use it in https://github.com/nicolargo/glances/issues/2183 ?

nicolargo avatar Nov 05 '22 07:11 nicolargo

@nicolargo

About using Pydantic, are we going to use it for all the stats and outputs of the all the plugins or just with FastAPI?

I am not sure how much of a performance overhead the runtime validation performed by pydantic would result in. We also have the option of using dataclasses or NamedTuples with proper typing to identify static typing errors.

What do you think?

RazCrimson avatar May 19 '23 19:05 RazCrimson

I think that the real value added is on the interface (REST). So for a first action, we will focus on the FastAPI data model.

nicolargo avatar May 20 '23 08:05 nicolargo

This issue is stale because it has been open for 3 months with no activity.

github-actions[bot] avatar Jul 08 '24 01:07 github-actions[bot]