apache / apache/otava

Use pydantic classes for json serialization

Open
#78 2 comments 1 reaction 1 assignee Claimed by @yongminkim0501 View on GitHub
Dominant language
Python
Stars
177
Forks
35
Avg merge
3d 16h
Merged PRs (30d)
6

Description

The Series and AnalyzedSeries classes support serializing themselves into json, via series.as_json() calls. This is not pythonic at all. (https://github.com/apache/otava/blob/8bb5e8eaaf8d0880650ad382c557963912e9454d/otava/series.py#L109)

It seems the modern best practice is to use Pydantic classes, which are like @dataclasses but better. In particular, a pydantic object can just be cast to dict(obj) or alternatively to json. https://docs.pydantic.dev/latest/concepts/serialization/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.