HLasse / TextDescriptives

A Python library for calculating a large variety of metrics from text
https://hlasse.github.io/TextDescriptives/
Apache License 2.0
308 stars 23 forks source link

Update quality filters to be pydantic v.2.0 compliant / convert to dataclasses #324

Closed HLasse closed 5 months ago

HLasse commented 7 months ago

Spacy <3.6.0 seems to require pydantic <2.0 (see image). So, tradeoff here. Do we want to support multiple spacy versions by requiring pydantic to be <2.0, OR do we require a newer version of spacy to be able to support newer versions of pydantic.

Alternatively, we can rewrite to dataclass, but then we lose this amazing documentation from autodoc_pydantic. (although I don't know how well sphinx's autodoc handles dataclasses with metadata fields.

image
HLasse commented 5 months ago

@KennethEnevoldsen any thoughts on this?

KennethEnevoldsen commented 5 months ago

Seems like spacy is working on pydantic v2, I either go with keeping the pydantic version in line with spacy or convert it to a dataclass. We don't really gain a lot from using a pydantic object here I believe a dataclass could do just fine as well.