You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using python-on-whales, there's a slight friction in that certain commands don't map directly to the CLI users of docker/podman are familiar with. The one that caught me out most recently was that client.container.ps() didn't work - it turns out I wanted client.ps() or client.container.list(). Perhaps more confusingly exec is available via a different spelling client.execute() and client.rmi() is not available with any spelling (instead requiring client.image.remove()).
I can see how it's ended up like this, but is it worth considering adding aliases to make things that users are likely to try more likely to "just work"? This isn't something I'd normally suggest, but I think makes sense when trying to mirror a command-line interface.
Uncomment DockerClient.rmi() as alias for ImageCLI.remove() for consistency with the CLI (and existence of DockerClient.ps())
Add Container.ps() (and Container.ls()?) alias(es) for Container.list() - note that the following are supported on the CLI (alongside docker|podman ps):
docker container ls, podman container ls (hidden command)
At the time it was made so that the code written with python-on-whales would be more readable than the code written in bash. Looking at it now, I believe that we should allow everything that the CLI allows, not more and not less. The goal of python-on-whales is to have an easy transition from the CLI, let's focus on that. It's up to the users to use what they think is best. Obviously for backward compatibility, we can't remove anything until the 1.0, but I think we can add aliases to mirror exactly what the CLI has.
When using python-on-whales, there's a slight friction in that certain commands don't map directly to the CLI users of docker/podman are familiar with. The one that caught me out most recently was that
client.container.ps()
didn't work - it turns out I wantedclient.ps()
orclient.container.list()
. Perhaps more confusingly exec is available via a different spellingclient.execute()
andclient.rmi()
is not available with any spelling (instead requiringclient.image.remove()
).I can see how it's ended up like this, but is it worth considering adding aliases to make things that users are likely to try more likely to "just work"? This isn't something I'd normally suggest, but I think makes sense when trying to mirror a command-line interface.
DockerClient.rmi()
as alias forImageCLI.remove()
for consistency with the CLI (and existence ofDockerClient.ps()
)Container.ps()
(andContainer.ls()
?) alias(es) forContainer.list()
- note that the following are supported on the CLI (alongsidedocker|podman ps
):docker container ls
,podman container ls
(hidden command)docker container ps
(hidden command),podman container ps
docker container list
(hidden command),podman container list
DockerClient.exec()
for consistency with the CLI, as an alias for the chosen nameDockerClient.execute()
?NetworkCLI.remove()
fordocker|podman network rm
I'm not suggesting allowing aliases for parameters, however, since that would add significant complexity to method signatures.
The text was updated successfully, but these errors were encountered: