python
python copied to clipboard
Discussion: machine-readable output
Breaking this out into a new issue for discussion from a couple other spots.
We should establish a format and standard way of accessing machine-readable output, most likely JSON, and then implement it in the CLI. Once we have an initial standard, other output options such as tabular formats can be more easily defined relative to a JSON format.
My preferred format would diverge as little as possible from things as defined in the protobufs for the sake of easier forward compatibility; if a field gets added somewhere, updating the protocol buffer definitions should as often as possible be all that's needed.
I think that there's probably several good ways to go about this, and the decisions may be closely tied with any reorganization of the CLI. Broadly, I think we might have two options:
- a single format that's able to express anything relevant within the same structure, which different commands and options would populate different parts of (for read operations) or only read/consider specific parts of (for write/update operations)
- a number of somewhat more command-specific formats not intended to be directly merged with one another but instead relying on the context of the command
To me, the first of these would be more consistent but more challenging to define fully and less well-suited for streaming data, while the second would be a little easier to create and better-suited for streaming but require more work from users in making their scripts understand the context of the data.
I don't have any sort of exclusive claim on ideas and there could easily be good options I haven't thought of! So please share your thoughts if you're a user of the CLI or might want to be a user of machine-readable outputs from the CLI.
Previously: #475, #566