dbt-labs / hologram

A library for automatically generating Draft 7 JSON Schemas from Python dataclasses
MIT License
9 stars 13 forks source link

make hologram happy with mypy #22

Closed beckjake closed 5 years ago

beckjake commented 5 years ago

Add mypy support to hologram. This also smooths out some of the rough edges with interaction between hologram and mypy.

Breaking Change: Because NewTypes can't be defined dynamically and mypy explicitly enforces that it's called with a string literal, users will have to pass a NewType(name, str) in to a new function (register_pattern). I don't think this is "better", but I don't really think it's worse. Maybe patterns should be metadata like restrict is instead of a standalone field encoder? It's hard to say.

I added #type: ignore to a few places that mypy struggled with.

added third-party stubs for jsonschema, so this includes a mypy.ini. mypy passes now and runs it in circle