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
Improve Python indexing example #227
Conversation
@@ -21,6 +18,14 @@ def _wheel_scanner_impl(target, ctx): | |||
fail("Didn't have workspace prefix") | |||
all_py_relative_paths.append(path[len(workspace_root) + 1:]) | |||
all_py_files.append(file) | |||
elif ctx.rule.kind == "py_proto_library": |
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.
The main changes are here. Instead of scanning for Python files in wheel, I'm grabbing the first file in DefaultInfo of the target.
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.
why not add all files and let the command sort it out?
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.
DefaultInfo#files
returns all Python files including from the dependency, so import would end up adding a bunch of unnecessary deps.
@@ -1,4 +1,5 @@ | |||
import pandas as pd | |||
from com.example.aa_pb2 import A |
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.
Here's a demo usage.
**Problem** In the current example Python indexing only tracks 3rdparty libraries, but not Protobuf-generated sources. **Solution** This adjusts the scripts to index both 3rdparty pip targets and Protobuf-generated sources.
6654a22
to
208a8e3
Compare
Problem
In the current example Python indexing only tracks 3rdparty libraries, but not Protobuf-generated sources.
Solution
This adjusts the scripts to index both 3rdparty pip targets and Protobuf-generated sources.