high-yak-85899
02/08/2022, 5:37 AMpyright
for type checking instead of mypy
? I'm finding mypy
incredibly prohibitive to get working. For a tool written to work with python as the intended target, they're rather inflexible. Pyright has been working great for us, but it's another thing that requires us to construct a large venv at the moment and type check every file all the time.happy-kitchen-89482
02/08/2022, 5:45 AMhappy-kitchen-89482
02/08/2022, 5:45 AMhigh-yak-85899
02/08/2022, 5:47 AMhappy-kitchen-89482
02/08/2022, 5:54 AMpyright
but I'm vaguely assuming it's similar to mypy in spirit?high-yak-85899
02/08/2022, 5:59 AMhigh-yak-85899
02/08/2022, 6:04 AMbitter-ability-32190
02/08/2022, 11:35 AMhappy-kitchen-89482
02/08/2022, 3:52 PMhigh-yak-85899
02/08/2022, 5:24 PMhigh-yak-85899
02/08/2022, 5:28 PMpants test
almost fully integrated has already made our build system happier!hundreds-father-404
02/08/2022, 5:32 PMGetting pants test almost fully integrated has already made our build system happier!Glad to hear! How so?
hundreds-father-404
02/08/2022, 5:36 PMbut it would probably be useful to get a rundown of how the mypy integration works at a high levelEssentially: 1. Determine which files/targets to run. MyPy needs transitive dependencies. We also do some fancy partitioning to handle multiple "resolves" (lockfiles) in the repo, along with multiple conflicting interpreter constraints like Py2 vs Py3 2. Build the MyPy PEX, along with an extra PEX if
[mypy].extra_type_stubs
is set. Separately, build a PEX for user requirements using pex_from_targets.py
3. Locate config files and set up the argv. Also we figure out what python_version
to use if you didn't already set it. Figure out MYPY_PATH and PYTHONPATH values
4. Use --pex-path
to merge all those PEXes from step 2 and invoke with inputs from step 3.high-yak-85899
02/08/2022, 5:37 PMpytest
and, despite parallelization, the build took around 4 to 5 minutes. With pants test
we're hitting at most around 40 seconds test time regularly and only use pytest
for the things we weren't able to migrate at this time (because of the way they're written).hundreds-father-404
02/08/2022, 5:39 PMhigh-yak-85899
02/08/2022, 5:40 PMpytest
like we were. We got remote cache set up really easily with our already existing bazel-remote
deployments so that's been an extra benefit.high-yak-85899
02/08/2022, 5:41 PMhundreds-father-404
02/08/2022, 5:44 PMhigh-yak-85899
02/08/2022, 6:15 PM