-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Support third-party stub external dependencies in pytype #9449
Conversation
@@ -17,7 +17,18 @@ objects at runtime. | |||
in the `tests` and `scripts` directories. | |||
|
|||
To run the tests, follow the [setup instructions](../CONTRIBUTING.md#preparing-the-environment) | |||
in the `CONTRIBUTING.md` document. In particular, we recommend running with Python 3.9+. | |||
in the `CONTRIBUTING.md` document. In particular, you have to run with Python 3.9+. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the wording here because since #9382, test/utils.py
(which is used by all tests) uses functools.cache
, which is unavailable in Python 3.8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practice we've required 3.9+ for a lot longer, due to the use of ast.unparse
in tests/check_new_syntax.py
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know. I believe you could still run other tests, so "recommend" wasn't too inaccurate :P
I only noticed because I had 3.8 installed in WSL.
…-external-dependencies
…sam/typeshed into pytype-external-dependencies
in the `CONTRIBUTING.md` document. In particular, we recommend running with Python 3.9+. | ||
in the `CONTRIBUTING.md` document. In particular, you have to run with Python 3.9+. | ||
|
||
In order for `pytype_test` and `pyright_test` to work correctly, some third-party stubs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same wording as before, just added "pytype_test
and" moved it up to avoid duplicating this entire paragraph.
Successful pytype run: https://github.com/python/typeshed/actions/runs/3833991938/jobs/6525955844 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! Some very minor points below
@rchen152, I'd love your opinion on this as a pytype maintainer, if you've the time. We're trying to rework our test suite to allow our third-party stubs packages to have dependencies on non-stubs packages external to typeshed which ship with The pyright approach has the advantage that the test code is much simpler and faster, but could lead to false negatives. If you add We could probably go either way when it comes to running pytype in CI — the "simple" approach we're using for pyright, or the "somewhat more principled" approach I'm proposing for mypy. The proposal in this PR is to use the pyright approach. Do you have any preference at all? |
Co-authored-by: Alex Waygood <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'll wait a little bit to see if the pytype maintainers have any thoughts before merging :)
Thanks for looping me in! This change looks good to me =) If mypy is already testing each package in isolation, it seems reasonable to use the "simple" approach for pytype. |
Brilliant, thanks for taking a look! |
Co-authored-by: Alex Waygood <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
Work towards #5768
Based on, and mostly a copy of what's done in, #9434 (hence I'm keeping this as draft until the pyright PR is merged)
I'll revert the demo changes in
METADATA.toml
after the above is merged.The pytype failure seen in #9374 seems to be caused by non-typed external dependencies, which we decided we won't support at the moment anyway.