-
Notifications
You must be signed in to change notification settings - Fork 542
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
feat(gazelle): Include types/stubs packages #2425
base: main
Are you sure you want to change the base?
Conversation
Thank you @ewianda for the contribution. @dougthor42, would you have time to look at this? |
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'll probably be able to test this out sometime this week.
Until then, here are some review comments. Also, please add a flag to turn this on or off. It should be off by default for now, and then in a couple releases we can consider making it on by default.
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.
Is there a way we can avoid committing the binary wheels here?
typeModule := fmt.Sprintf("%s_types", strings.ToLower(distributionName)) | ||
if dep, _, ok := cfg.FindThirdPartyDependency(typeModule); ok { | ||
deps.Add(dep) | ||
|
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.
Nit: remove extra newline
// Add the type and stub dependencies if they exist. | ||
typeModule := fmt.Sprintf("%s_types", strings.ToLower(distributionName)) | ||
if dep, _, ok := cfg.FindThirdPartyDependency(typeModule); ok { | ||
deps.Add(dep) |
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.
Please add a test case for these two to gazelle/python/testdata
whl = pathlib.Path( | ||
pathlib.Path(__file__).parent, "testdata", "pytest-7.1.1-py3-none-any.whl" | ||
) |
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.
Nit: use /
to build path:
whl = pathlib.Path(__file__).parent / "testdata" / "pytest-7.1.1-py3-none-any.whl"
This PR adds logic that checks if a package has a corresponding
types
orstubs
package and automatically adds that to the BUILD file. This is useful for typeckers e.g pyright , mypy