NREL / routee-compass

An energy-aware routing engine
https://nrel.github.io/routee-compass/
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

Complete type annotations #227

Open SnoopJ opened 4 months ago

SnoopJ commented 4 months ago

Closes #214

This changeset adds a bunch of missing annotations and other fixes/workarounds to get routee-compass to a complete set of annotations (i.e. mypy --strict can be run over the whole wrapper with no errors). This also updates and re-enables the type-checking step of the test workflow (and adds the necessary type stubs to the [dev] extra)

nreinicke commented 4 months ago

Thanks for adding all of these in! We made a couple of changes when sprinting today that will cause a couple merge conflicts here (sorry!)

We also decided to make the geospatial-like dependencies optional and then just rely on the TYPE_CHECKING parameter and en-quoting the optional types.

SnoopJ commented 4 months ago

No trouble at all on the merge conflicts, I'll sort them out. Guarding/quoting the geospatial stuff sounds pretty straightforward to take care of.

It turned out that I didn't have much time today, but I did get a few moments to look at the problems with the annotation of the agg parameter. The core problem is I believe the conflict between Union[VeryLongCallableT, overloaded function] and Optional[VeryLongCallableT], but I'm not entirely sure what the overloaded bit is about.