blob: caca239f78c81acdf0adf3eaeed081af12317a09 [file] [log] [blame]
import json
import subprocess
def main():
# equivalent to using your command line with
# `hamilton --verbose --json-out version ./module_v1.py`
result = subprocess.run(
["hamilton", "--verbose", "--json-out", "version", "./module_v1.py"],
stdout=subprocess.PIPE,
text=True,
)
# `--json-out` outputs the result as JSON string on a single line
# `--verbose` outputs intermediary commands on separate lines
responses = []
for line in result.stdout.splitlines():
command_response = json.loads(line)
responses.append(command_response)
print(responses)
if __name__ == "__main__":
main()