happy-kitchen-89482
05/18/2022, 4:39 AMcheck
on python code with [mypy].interpreter_constraints is set, we don't actually use those constraints on targets that have their own ICs[mypy].interpreter_constraints
explicitly should just bypass the partitioning and all that, and just do the simple and obvious thing that is implied by thatenough-analyst-54434
05/18/2022, 5:35 AMmypy --python-version X.Y
. In the Pex case this would be like using the Pants mypy ICs to create the right MyPy PEX tool, and then running the tool over ~each Python major.minor implied by the code being checked ICs. And in the Pex case this is important since Pex works with 2.7 which has different type checking concerns than 3.x - namely around unicode vs str. I'm not sure if that generalizes to differences in 3.x version or not and I'm pretty darn sure its not performant to just auto-cover the IC range like that.--python-version
.hundreds-father-404
05/18/2022, 12:25 PMpython_version
to force a versionenough-analyst-54434
05/18/2022, 12:41 PM--python-version 2.7
hundreds-father-404
05/18/2022, 12:45 PMtyped_ast
. MyPy could understand prior Python versions than the interpreter it was run withenough-analyst-54434
05/18/2022, 12:48 PM--python-version {2.7,3{5,10,11}}
happy-kitchen-89482
05/18/2022, 2:48 PMpython_version
is something different - it's the version targeted by mypy, not the version we run mypy on--python-version
dynamically in each partition, unless it's already set in mypy.ini or args[mypy].interpreter_constraints
explicitly to Python 3.9 yet I still get partitioning, and one of the partitions runs mypy on 3.6, because that code has permissive constraints[mypy].interpreter_constraints
explicitly, the tool lockfile is generated for those constraints, so running it on other constraints might not even work[mypy].interpreter_constraints
explicitly we should always run with that, but still partitioning if we're setting python_version
dynamically, and if you set python_version
explicitly in mypy.ini
then we shouldn't partition at all?mypy.ini
unless there's a conflict. It's weird to warn about normal use of a tool config file.[mypy].interpreter_constraints
isn't right - those are constraints for generating a lockfile, and we may want a lockfile compatible with multiple versions of mypy (in this case because we need to run mypyc at package time on several different interpreters)enough-analyst-54434
05/18/2022, 3:26 PMWell,Absolutely agreed. We need just 2 things: 1.) A valid Python to run MyPy with - this need have 0 to do with what Python your code under check needs to run. 2.) --python-version to say which interpreter to run the check using The partitioning and other complications are just that. I have 0 clues what that is / what we do there, but the above 2 facts need to be the basis.is something different - it's the version targeted by mypy, not the version we run mypy onpython_version
hundreds-father-404
05/18/2022, 3:58 PM[mypy].interpreter_constraints
is meant to be #1. Partitioning + the allowance for python_version
is meant to be #2happy-kitchen-89482
05/18/2022, 4:00 PM[mypy].interpreter_constraints
and use the code's constraints insteadhundreds-father-404
05/18/2022, 4:01 PMhappy-kitchen-89482
05/18/2022, 4:01 PMhundreds-father-404
05/18/2022, 4:01 PMhappy-kitchen-89482
05/18/2022, 4:02 PMhundreds-father-404
05/18/2022, 4:03 PMhappy-kitchen-89482
05/18/2022, 4:06 PMhundreds-father-404
05/18/2022, 4:10 PMhappy-kitchen-89482
05/18/2022, 4:11 PM