Skip to content
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

Initial pyright config #4192

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Jan 25, 2024

Summary of changes

Work towards step 2 of #2345 (comment) . Non-trivial fixes should go in a different PR.
Merge #3979 and #4257 first.
npx -y pyright@1.1.359 . --pythonversion=3.8|3.11 --pythonplatform=Linux|Windows results:
0 errors, 387 warnings, 0 informations

Pull Request Checklist

.github/workflows/main.yml Outdated Show resolved Hide resolved
@Avasam Avasam changed the title Pyright initial config Initial pyright config and turn on type-checking in CI Jan 25, 2024
@@ -138,3 +143,4 @@ def get_output_mapping(self) -> Dict[str, str]:
Destination files should be strings in the form of
``"{build_lib}/destination/file/path"``.
"""
...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python should not require ellipsis when the docstring is provided. I am not 100% inline with the comment of the pyright maintainer... The reason why the linters don't complain about it, is because there is nothing wrong 😅

Does mypy also complains about it?
Should we just stick with mypy for now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the problem here is because we are talking specifically about prototypes, and the spec says:

Bodies of protocol methods are type checked.

That is a bit disappointing... These pesky ellipsis can be annoying

Copy link
Contributor

@abravalheri abravalheri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Avasam , thank you very much for the efforts in this field. I understand that this is a wipe, but I left a few comments, hopefully that is fine with you.

@@ -138,3 +143,4 @@ def get_output_mapping(self) -> Dict[str, str]:
Destination files should be strings in the form of
``"{build_lib}/destination/file/path"``.
"""
...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python should not require ellipsis when the docstring is provided. I am not 100% inline with the comment of the pyright maintainer... The reason why the linters don't complain about it, is because there is nothing wrong 😅

Does mypy also complains about it?
Should we just stick with mypy for now?

setuptools/command/easy_install.py Outdated Show resolved Hide resolved
@Avasam
Copy link
Contributor Author

Avasam commented Jan 25, 2024

I understand that this is a [wip] but I left a few comments, hopefully that is fine with you.

Perfectly fine! I'm just waiting for a merge on #3979 (there's some overlap) before publishing the PR.
I especially need guidance on running type-checkers (mypy/pyright) on the CI (tox/pytest setup) to prevent regressions.

@Avasam Avasam mentioned this pull request Mar 5, 2024
2 tasks
@Avasam Avasam changed the title Initial pyright config and turn on type-checking in CI Initial pyright config Mar 6, 2024
@Avasam Avasam force-pushed the pyright-initial-config branch 2 times, most recently from 872fc45 to 257efa3 Compare March 6, 2024 21:07
@Avasam
Copy link
Contributor Author

Avasam commented Mar 6, 2024

The hundreds (763) of information: Analysis of function "..." is skipped because it is unannotated are probably quite undesirable (we just started an error to remove spam in logs from EncodingWarning...) so I've opened microsoft/pyright#7415

Edit: Looks like there's a lot less errors than when I initially tried this, so "analyzeUnannotatedFunctions": false wasn't really necessary.

@Avasam Avasam marked this pull request as ready for review March 8, 2024 05:21
mypy.ini Outdated Show resolved Hide resolved
mypy.ini Outdated Show resolved Hide resolved
setup.cfg Outdated Show resolved Hide resolved
Comment on lines +23 to +25
// Dynamically defined module-level variables declared as None in pkg_resources lead to a lot of false-positives
// TODO: Fix how these variables are typed
"reportOptionalCall": "warning",
Copy link
Contributor Author

@Avasam Avasam Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants