buildozer can print the tags listed directly in the BUILD file, but doesn't expand macros: `buildozer 'print tags' //some/target`
If you're okay parsing XML, `bazel query --output=xml //some/target` will list the tags after macro expansion.
--output=proto and --output=streamed_proto are also options, if that's easier.
Finally, my personal favorite hack: use Python's eval to parse the output of `bazel query --output=build`
```
bazel query --output=build 'kind(sh_test, //some/targets/...)' | python -c '
import sys
def sh_test(tags, **kwargs):
print(tags)
eval(sys.stdin.read())
'
```