pants
pants copied to clipboard
Expose `print` or some other debugging statement from macros
Similar to #16174, it would be useful to expose print
. The worst case abuse of print
is essentially to (accidentally?) spam your users, and so it is a known-safe side-effect.
Can someone guide me on how can I work on this? Would be greatly appreciated
@Kaushik-Iyer : Sorry for the delay!
This would look a lot like the issue I linked above: https://github.com/pantsbuild/pants/pull/16174/files
Essentially, when computing the globals
to use when evaluating BUILD
files, you would leave print
exposed in the builtins.
not sure if I should create a new issue for this - but I believe this is actually "done"? it seems to me that a bug was introduced by https://github.com/pantsbuild/pants/pull/16174 (relating to how Python implicitly populates builtins in the globals
dictionary passed to exec
) that makes all builtins automatically available in macros - if you add a print
or breakpoint
call to a macro at present, it will "just work" (not as intended)
@marcuslimdw Thank you for raising this. I've verified it does indeed work. I suggest to leave this open until we have a test case in place ensuring this holds into the future.