Open NicolasRouquette opened 8 months ago
Thanks, @NicolasRouquette, for reporting this.
Just to make sure we are on the same page, I recall make check-types
is okay in main---see this run. When we run make check-types
, we execute mypy with the configuration file config/mypy.ini
. Would it be sufficient to add this configuration to VS Code for its integration with mypy to be clean? If yes, perhaps we should add a VS Code configuration file to the project. Also, do you know what is the relation between Pylance and VS Code's integration with mypy? I recall Pylance does some type checking for Python in VS Code.
The problem manifests in VS Code but the root cause is in the lack of published stubs or py-typed markers: https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker
That is, we need Pacti to publish such stubs or markers. There is a semi-automated process that involves two steps:
I tested this approach for the pacti-instrumentation repo.
pdm run stubgen .\src\pacti_instrumentation\pacti_counters.py
Processed 1 modules
Generated out\pacti_instrumentation/pacti_counters.pyi
Then we have to manually review the generated stub in the out
folder and copy it in the src
folder like this:
https://github.com/pacti-org/pacti-instrumentation/tree/master/src/pacti_instrumentation
Since we have to review/revise the generated stubs, we could have CI run stubgen
and provide a report about differences, if any, but not fail the workflow since some differences may be intentional.
Describe the bug A clear and concise description of what the bug is.
With VsCode configured for type analysis with mypy, we get several problems with Pacti imports.
Each of the above line produces an analysis error like this:
To Reproduce
pdm install
Expected behavior A clear and concise description of what you expected to happen.
Pacti imports should yield no type analysis errors with mypy.
Screenshots If applicable, add screenshots to help explain your problem.
System (please complete the following information):
Additional context Add any other context about the problem here.