I found that adding a print
statement to my bazel macros and rule implementations result in console output added to the build such as
DEBUG: /home/$USER/repo/source.bzl:82:5: message XYZ
And I can even introspect a bit of objects with standard python techniques like...
def my_macro(my_list):
print(my_list)
print(type(my_list))
print(dir(my_list))
DEBUG: /home/$USER/repo/source.bzl:83:5: ["//visibility:public"]
DEBUG: /home/$USER/repo/source.bzl:84:5: list
DEBUG: /home/$USER/repo/source.bzl:85:5: ["append", "extend", "index", "insert", "pop", "remove"]
Is there anyway to access things like in the traceback module to look at stack traces and what not? Maybe even something like importing pdb and setting a break point?