https://pantsbuild.org/ logo
#development
Title
# development
b

bitter-ability-32190

02/18/2022, 1:39 AM
(Somewhat of a small soapbox) So part of adding the new Options API was making sure we get the deduced property types right. No way to really test that in mypy. There's 3 tools in the wild that can help (https://pantsbuild.slack.com/archives/C0D7TNJHL/p1643838778597069) but they all invoke
mypy
in a subcprocess one way or another which doesn't work well in Pants' execution model. Turns out
pyright
(as of this year) and
pytype
have type assertions built-in, and it might make it into
typing_extensions
, but
mypy
is no-dice. So, I had some fun and decided to hack it in
mypy
through a plugin. Introducing my first and only PyPI package:
mypy-typing-asserts
https://github.com/thejcannon/mypy-typing-asserts And the resulting Pants PR (where the plugin found several issues 😈 ) https://github.com/pantsbuild/pants/pull/14527
🙌 2
The package and repo are purposefully very light. My hope is eventually this gets deprecated by something in
typing_extensions
.
b

busy-vase-39202

02/18/2022, 1:45 AM
"....where it found several issues..." Terrific! Thank you.
b

bitter-ability-32190

02/18/2022, 1:47 AM
FWIW all the issues were introduced by me 🙂 But that's what happens when you can't test your code. You're asking for bugs.
h

happy-kitchen-89482

02/18/2022, 1:58 AM
gasp
b

busy-vase-39202

02/18/2022, 2:37 AM
Hahaha I could watch that on repeat all day. It's hypnotic.