ApeWorX / ethpm-types

Implementation of EIP-2678
Apache License 2.0
14 stars 8 forks source link

feat!: pydantic v2 upgrade [APE-1408] #90

Closed antazoey closed 9 months ago

antazoey commented 11 months ago

What I did

Upgrades to pydantic v2, first pass.

fixes: #89 Fixes: APE-1408

How I did it

Tried following the migration guide.

Good News

Bad News
  1. I was not able to use Annotated for Hex because it has new methods added, so the other option is not as recommended because it uses some stuff in pydantic that may change (according to them)
  2. Difficult sort_keys and have custom separators, as json dumping kwargs are gone. There are new decoratored for firled serializers though, that is pretty neat, and even one for the whole model. However, it was still simpler to override the model dumping methods, however it feels wrong to sort the keys this way; I would like to find a better way.
  3. mypy stopped working for me locally for this, not sure why, it just crashes..

How to verify it

Checklist

fubuloubu commented 11 months ago

Should be released as v0.6.0, coinciding with peer breaking change releases of evm-trace and ape

antazoey commented 10 months ago

about to do something wicked with model JSON schema... Pydantic V2 is cool and will help us with our PackageManifest tool and FastAPI a lot.