python-on-whales icon indicating copy to clipboard operation
python-on-whales copied to clipboard

[Question] Streaming output from push

Open baptistecolle opened this issue 1 year ago • 3 comments

Hi,

First of all thanks for the amazing package.

Is there a way to stream output for the push command? Indeed, for example, the build command as a stream_logs argument that allows this behavior

baptistecolle avatar Nov 08 '23 14:11 baptistecolle

I'm glad this package is useful to you! And thanks for the issue. This is not possible right now, but I'll keep it somewhere on the back of my mind, I might allow it in the future. For the moment, you can only see the logs directly in python's stdout, but I suppose that if you opened the issue, it's not enough to satisfy your use case.

By the way I'd be interested to know why you want to do that. This might help me provide a better api for the users long-term :)

gabrieldemarmiesse avatar Nov 11 '23 15:11 gabrieldemarmiesse

I am currently building a CLI that uses the docker client under the hood. Thus, I need to parse the output of docker commands in order to get information from them. For example, for the push command, I want to parse to output to give an eta on the duration of the push.

However, right now it seems not possible to capture the output of the python-on-whales methods. https://github.com/gabrieldemarmiesse/python-on-whales/issues/292#issuecomment-1809738612

baptistecolle avatar Nov 14 '23 08:11 baptistecolle

Indeed, i'm currently working on capturing the logs of compose commands, I guess we could do something similar for push.

Concerning the default behaviour, the only way I found to avoid messing up the TTY output was to not capture anything. But maybe there is a better way by going through the python process, but I'm not aware of it.

gabrieldemarmiesse avatar Nov 14 '23 08:11 gabrieldemarmiesse