refined-cat-61929
04/17/2024, 6:19 PMpyi files for protobufs (necessary for tools like mypy and pyright to work) doesn't have support for Python 3.12. Generating those pyi files happens via the pants.toml file:
[python-protobuf]
mypy_plugin = true
However, because Pants uses pip 23 instead of 24, and there doesn't seem to be a way to install this tool from a lockfile, it complains that pip 23 isn't compatible with Python 3.12.
So, can anyone confirm that my understanding is correct, that it's either pyi generation or Python 3.12, but not both?happy-kitchen-89482
04/17/2024, 8:06 PMhappy-kitchen-89482
04/17/2024, 8:07 PMpiphappy-kitchen-89482
04/17/2024, 8:07 PMrefined-cat-61929
04/17/2024, 8:39 PM[python]
interpreter_constraints = ["==3.12.*"] # was there before
enable_resolves = true. # was there before
pip_version = "24.0"
[pex-cli]
version = "v2.3.1"
known_versions=[
"v2.3.1|macos_arm64|71690e672871b55323f5d6ef9a3fe9705f1668662652c4081080e7ab27d44de3|4124530"
]
However, it still is using pip 23. I'm guessing the problem is that it is pex that has to be given the argument of what pip to use, and I don't see a way to do that.
Here's the exact error:
ProcessExecutionFailure: Process 'Building mypy_protobuf.pex from <resource://pants.backend.codegen.protobuf.python/mypy_protobuf.lock>' failed with exit code 1.
stdout:
stderr:
The Pip requested was pip==23.0.1 but it does not work with the interpreter selected which is CPython 3.12.3 at /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/bin/python3.12. Pip 23.0.1 requires Python <3.12,>=3.7.happy-kitchen-89482
04/17/2024, 9:45 PMpip_version = "latest" ?happy-kitchen-89482
04/17/2024, 9:45 PMhappy-kitchen-89482
04/17/2024, 9:45 PMrefined-cat-61929
04/17/2024, 9:48 PMpip_version to, it is using 23.0.1. Perhaps I'm making a mistake in setting in [python] and not somewhere else?happy-kitchen-89482
04/17/2024, 11:43 PMhappy-kitchen-89482
04/17/2024, 11:44 PMhappy-kitchen-89482
04/17/2024, 11:44 PMhappy-kitchen-89482
04/17/2024, 11:46 PMhappy-kitchen-89482
04/17/2024, 11:46 PMhappy-kitchen-89482
04/17/2024, 11:47 PMrefined-cat-61929
04/18/2024, 12:45 AMhappy-kitchen-89482
04/18/2024, 12:47 AMrefined-cat-61929
04/18/2024, 12:55 AMbroad-processor-92400
04/18/2024, 1:24 AMmypy_protobuf tool, by creating a resolve for it, adding the relevant tool(s) to it with a python_requirement and pointing [mypy-protobuf].install_from_resolve to thatrefined-cat-61929
04/18/2024, 1:40 AM[mypy-protobuf].install_from_resolve , at least in the Pants version I'm using (2.19.1), maybe it was added later?broad-processor-92400
04/18/2024, 1:52 AMrefined-cat-61929
04/18/2024, 2:03 AM