-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pyright CLI and problem tab gives different results. #2255
Comments
Pylance is built on top of pyright, so they should give the same results. There are a few reasons why you might see small differences:
It looks like you're trying to use many of the strict type checking features including the "reportUnknownXXX" diagnostic checks. These checks rely on complete type information from libraries. If you are consuming any libraries that are not fully and accurately typed, you will likely run into problems. We normally recommend against using "useLibraryCodeForTypes" with type checking — and especially with strict-mode type checking — because it relies on type inference, and that often results in incomplete or inaccurate types. |
Hi @erictraut, Thanks a lot for the complete response. Indeed the problem came from Now I have the same output in the tab and in the CLI. Have a great day. |
Hello, I'm trying to use CI/CD (Pyright in github actions) and I do not have the same results in command line and in vscode. My structure is :
The {
"enableTypeIgnoreComments": true,
"exclude": [],
"executionEnvironments": [],
"extraPaths": [
"typings/python-type-stubs"
],
"ignore": [
"production",
"typings",
".venv/*"
],
"pythonVersion": "3.8",
"include": [],
"strict": [],
"strictDictionaryInference": true,
"strictListInference": true,
"strictParameterNoneValue": false,
"strictParametererrorValue": true,
"strictSetInference": true,
"stubPath": "",
"typeCheckingMode": "strict",
"typeshedPath": "",
"useLibraryCodeForTypes": true,
"venv": ".venv",
"venvPath": ".",
"verboseOutput": false,
"reportUnusedExpression": "error",
"reportAssertAlwaysTrue": "error",
"reportCallInDefaultInitializer": "error",
"reportConstantRedefinition": "error",
"reportDuplicateImport": "error",
"reportFunctionMemberAccess": "error",
"reportGeneralTypeIssues": "error",
"reportImplicitStringConcatenation": "error",
"reportImportCycles": "error",
"reportIncompatibleMethodOverride": "none",
"reportIncompatibleVariableOverride": "error",
"reportIncompleteStub": "error",
"reportInconsistentConstructor": "error",
"reportInvalidStringEscapeSequence": "error",
"reportInvalidStubStatement": "error",
"reportInvalidTypeVarUse": "error",
"reportMissingImports": "error",
"reportMissingModuleSource": "error",
"reportMissingParameterType": "error",
"reportMissingTypeArgument": "error",
"reportMissingTypeStubs": "none",
"reportOptionalCall": "error",
"reportOptionalContextManager": "error",
"reportOptionalIterable": "error",
"reportOptionalMemberAccess": "error",
"reportOptionalOperand": "error",
"reportOptionalSubscript": "error",
"reportOverlappingOverload": "error",
"reportPrivateImportUsage": "error",
"reportPrivateUsage": "none",
"reportPropertyTypeMismatch": "error",
"reportSelfClsParameterName": "error",
"reportTypedDictNotRequiredAccess": "error",
"reportUnboundVariable": "error",
"reportUndefinedVariable": "error",
"reportUninitializedInstanceVariable": "error",
"reportUnknownArgumentType": "error",
"reportUnknownLambdaType": "error",
"reportUnknownMemberType": "none",
"reportUnknownParameterType": "error",
"reportUnknownVariableType": "error",
"reportUnnecessaryCast": "error",
"reportUnnecessaryComparison": "error",
"reportUnnecessaryIsInstance": "none",
"reportUnnecessaryTypeIgnoreComment": "none",
"reportUnsupportedDunderAll": "error",
"reportUntypedBaseClass": "error",
"reportUntypedClassDecorator": "error",
"reportUntypedFunctionDecorator": "none",
"reportUntypedNamedTuple": "error",
"reportUnusedCallResult": "none",
"reportUnusedClass": "error",
"reportUnusedCoroutine": "error",
"reportUnusedFunction": "none",
"reportUnusedImport": "error",
"reportMissingSuperCall": "none",
"reportMatchNotExhaustive": "error",
"reportUnusedVariable": "error",
"reportWildcardImportFromLibrary": "error",
} I have no error in the "problem" tab in vscode but 26 appears when running pyright with :
The errors are mostly related to pandas like : (mostly coming from pandas.read_csv()) Hovering with the mouse in vscode indicate that the variable ( Thanks in advance for any help Have a great day. |
I tried to solve the problem, and I'm using the latest (master branch) version of python-type-stubs. Still getting the same error... |
In your settings you could try pointing directly to the stubs that pylance shipped with. in settings.json
|
Hello @bschnurr, thanks for the fast reply. I do not have any Maybe it's just pylance that is not using the same pyright version (as point 3 of the comment) ? I'm cloning it also when doing my ci/cd so I can replicate the same behavior as vscode/pylance in my github action. I tried to add the stub file as you said, it change nothing for pylance (as it should be the same as used by default) and I still have the same errors in pyright. New config is : "enableTypeIgnoreComments": true,
"exclude": [],
"executionEnvironments": [],
"extraPaths": [
"./typings/python-type-stubs"
],
"ignore": [],
"include": [
"./packages"
],
"strict": [],
"strictDictionaryInference": true,
"strictListInference": true,
"strictParameterNoneValue": false,
"strictParametererrorValue": true,
"strictSetInference": true,
"stubPath": "./typings/python-type-stubs",
"typeCheckingMode": "strict",
"typeshedPath": "",
"useLibraryCodeForTypes": true,
"venv": ".venv",
"venvPath": ".",
"verboseOutput": false,
"pythonVersion": "3.8",
"repportXXXXX": "true or false" I also tried to change exclude, include, extraPaths but without success. Pyright when running is reading this config file (pyrightconfig.json) as I can see it in the output. So it's the same config as Pylance should have. It find all the files but raise typing errors that pylance does not. I tried pyright 1.1.236 and then 1.1.235 (as it seems to be the one used by pylance) and both raise the same problems |
still an issue with latest pyright/pylance? |
Hello @bschnurr, I re-installed my venv from scratch and pull all latest Could be from my end though (maybe missing a small dependency or the last night version of something)... but I gave up on having the CI as it didn't give the same results and I changed a bit my workflow to adapt to that but it's okay :) |
Environment data
A poetry project with a
pyrightconfig.json
.There is no
.vscode
withsettings.json
nor any config in thepyproject.toml
Expected behaviour
Having the same problems in the "problem" tab and when running
pyright
by handActual behaviour
I fixed all the problems in the "problems" tab but when running pre-commit the pyright check didn't pass... So I tried to run it by hand (
poetry run pyright
) and indeed, pyright (by hand) gives "new" errors (not shown in the problems tab)Pyright config
Logs
Code Snippet / Additional information
The text was updated successfully, but these errors were encountered: