However, when trying this Bazel complained with this message:
ERROR: /home/ubuntu/.cache/bazel/_bazel_ubuntu/190ed845c43fd8fe2a479fa4f23ed0f1/external/rules_mypy~/BUILD.bazel: no such target '@@rules_mypy~//:mypy.ini': target 'mypy.ini' not declared in package '' defined by /home/ubuntu/.cache/bazel/_bazel_ubuntu/190ed845c43fd8fe2a479fa4f23ed0f1/external/rules_mypy~/BUILD.bazel
ERROR: /home/ubuntu/bazel-exploration/examples/basic_python/BUILD:4:10: every rule of type py_binary implicitly depends upon the target '@@rules_mypy~//:mypy.ini', but this target could not be found because of: no such target '@@rules_mypy~//:mypy.ini': target 'mypy.ini' not declared in package '' defined by /home/ubuntu/.cache/bazel/_bazel_ubuntu/190ed845c43fd8fe2a479fa4f23ed0f1/external/rules_mypy~/BUILD.bazel
Target //examples/basic_python:a up-to-date:
bazel-bin/examples/basic_python/a
bazel-bin/examples/basic_python/a.venv.pth
Based on the message, it seems that the //:mypy.ini string is being evaluated from the context of rules_mypy instead of my repo. Indeed, I was able to resolve the error by using the following syntax instead:
The Label() call seems to make things resolve properly. Ideally this can be solved internally, but if not the README could be updated to suggest this fix.
According to the README, using my own
mypy.ini
file can be done as follows:However, when trying this Bazel complained with this message:
Based on the message, it seems that the
//:mypy.ini
string is being evaluated from the context ofrules_mypy
instead of my repo. Indeed, I was able to resolve the error by using the following syntax instead:The
Label()
call seems to make things resolve properly. Ideally this can be solved internally, but if not the README could be updated to suggest this fix.