-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Doesn't work with generated code: "k8-fastbuild is not a valid Python package name" #15
Comments
Looks that 2 hacks work: If you think a repro is important, I can try to make one. Thanks! |
I've created what I think is a repro of your problem here: https://github.com/thundergolfer/bazel-python-mypy-protobuf I've also added you as a contributor in case you need to fix up any inaccuracies in my repro 🙂 |
@cxcxcxcx see #11 that applies your second option. In particular see https://github.com/thundergolfer/bazel-mypy-integration/pull/11/files#diff-c7aad2fe686a5c09d5d246bd6242f633 Line 146 I'm sure we can come up with a safer hack :) |
I have bumped across similar issue while using https://github.com/rules-proto-grpc/rules_proto_grpc Getting the following error
Any update on this issue? |
Is there a workaround for this? for anything that depends on protocol buffers or grpc I'm getting:
See build output. |
@juanique @thepurpleowl Here is the workaround I'm currently using for this issue.
diff --git a/mypy.bzl b/mypy.bzl
index 2ab74fe..ec19e50 100644
--- a/mypy.bzl
+++ b/mypy.bzl
@@ -174,7 +174,7 @@ def _mypy_rule_impl(ctx, is_aspect = False):
]),
"{SRCS}": " ".join([
shell.quote(f.path) if is_aspect else shell.quote(f.short_path)
- for f in src_files
+ for f in src_files if not f.path.startswith("bazel-out")
]),
"{VERBOSE_OPT}": "--verbose" if DEBUG else "",
"{VERBOSE_BASH}": "set -x" if DEBUG else "",
http_archive(
name = "mypy_integration",
patch_args = ["-p1"],
patches = ["//tools/mypy:mypy.patch"],
sha256 = "9a6837afe5d4953bdfaeed8ff6572c9958845a932f835c2c1058b5fe67bf573f",
strip_prefix = "bazel-mypy-integration-0.2.1",
url = "https://github.com/thundergolfer/bazel-mypy-integration/archive/0.2.1.tar.gz",
)
[mypy-your.api.module.*]
follow_imports = skip While this solution is super hacky, it should unblock you until a more permanent solution is released. I've tested this on the rules_proto_grpc |
I hit the problem because I'm using https://github.com/pubref/rules_protobuf
In general, if generated Python code is referenced, it will cause an error. In the sandbox, the files has paths like
bazel-out/k8-fastbuild/bin/...
.It's making the entire tool unusable, one option could be skipping files in bazel-out dir for now.
The text was updated successfully, but these errors were encountered: