average-sugar-68948
12/21/2022, 2:42 PM./pants check ::
09:37:48.34 [INFO] Completed: Building requirements.pex with 5 requirements: bitarray==2.5.1, numpy==1.23.4, protobuf==4.21.12, simpy==4.0.1, types-protobuf==4.21.0.2
09:37:48.75 [INFO] Completed: Building requirements_venv.pex
09:37:49.18 [ERROR] Completed: Typecheck using MyPy - mypy failed (exit code 1).
fabric/proto/v1/workload_pb2.pyi:6: error: Library stubs not installed for "google.protobuf.descriptor" (or incompatible with Python 3.7)
fabric/proto/v1/workload_pb2.pyi:6: note: Hint: "python3 -m pip install types-protobuf"
fabric/proto/v1/workload_pb2.pyi:6: note: (or run "mypy --install-types" to install all missing stub packages)
...
enough-analyst-54434
12/21/2022, 3:08 PMaverage-sugar-68948
12/21/2022, 3:09 PMenough-analyst-54434
12/21/2022, 3:13 PMaverage-sugar-68948
12/21/2022, 3:17 PM--python-version 3.9
to mypy, didn't helpenough-analyst-54434
12/21/2022, 3:25 PM--keep-sandboxes=on_failure
there will be a line printed near the mypy failure that reveals a temporary directory you can examine. That will contain a `__run.sh`script that can be used to emulate and inspect what happened. See: https://www.pantsbuild.org/docs/rules-api-tips#debugging-look-inside-the-chroot
That may be the best path forward in your debugging quest.adventurous-journalist-72920
12/21/2022, 4:13 PMtypes-protobuf
in [mypy].extra_type_stubs in pants.toml
(along with one specific lockfile for mypy and one for the extras).
I don’t have the error anymore.--show-traceback
in args, so Mypy gives more details on errorsaverage-sugar-68948
12/21/2022, 4:52 PM./pants check ::
fail?enough-analyst-54434
12/21/2022, 4:55 PMaverage-sugar-68948
12/21/2022, 4:55 PMenough-analyst-54434
12/21/2022, 4:55 PMaverage-sugar-68948
12/21/2022, 4:58 PMenough-analyst-54434
12/21/2022, 5:01 PMaverage-sugar-68948
12/21/2022, 9:33 PMadventurous-journalist-72920
12/21/2022, 9:51 PM./pants export-codegen
writes transpiled python classes into dist/codegen
, is there any way to change that? That would probably solve the problem, or at least, help a lot.average-sugar-68948
12/22/2022, 2:47 PMdist/codegen
would have to do with it - check is finding the .pyi's (like it's supposed to?), the stubs just aren't getting installedadventurous-journalist-72920
12/23/2022, 2:04 PM[mypy]
args = ["--namespace-packages"]
(in pants.toml)average-sugar-68948
12/23/2022, 3:20 PMrun
goal. For example, ./pants run run.py
in that test repo (pull for update) results in an import error, even though dependencies --transitive
lists the proto target properly. The test
goal doesn't seem to have this problem (./pants test tests/
). Am I doing something wrong?adventurous-journalist-72920
12/23/2022, 8:01 PM__init__.py
file within proto
folder. As of right now, it’s unclear to me why test works and run does not, I would have expected none to work.
I need to dig more in order to give you a satisfying answer, but you can just remove the __init__.py
file from proto and try again 🙂average-sugar-68948
01/03/2023, 2:58 PM__init__.py
does the trick