harvard-lil / h2o

H2O is a web app for creating and reading open educational resources, primarily in the legal field
https://opencasebook.org
GNU Affero General Public License v3.0
36 stars 30 forks source link

Upgrade mypy to 1.1, the latest compatible with django-stubs #2002

Closed lizadaly closed 1 year ago

lizadaly commented 1 year ago

Some dependency upgrades (including a minor one for psycopg2) but mainly to get mypy over the 1.0 hurdle, which had been blocked on django-stubs. I was prompted to do this by running into some Django type hassles in my main ticket which I'm hoping this will ameliorate (but if not hey it's upgraded now).

The upgrade involved a couple of changes to type declarations, mostly because mypy now warns if you include types inside a function without typedefs in the signature. In most cases I tried to add some types in the signature (this mostly affected tests) but in a few cases I removed types because mypy had trouble resolving some imports or it otherwise did not make sense to do so.

(The new warning behavior is good because it caught several cases where I had the wrong type but it hadn't been previously caught by type-checking, equivalent to bad documentation.)