Skip to content

Potential better Podman support via client inheritance#697

Closed
Hasnainz wants to merge 0 commit intogabrieldemarmiesse:masterfrom
Hasnainz:master
Closed

Potential better Podman support via client inheritance#697
Hasnainz wants to merge 0 commit intogabrieldemarmiesse:masterfrom
Hasnainz:master

Conversation

@Hasnainz
Copy link
Contributor

@Hasnainz Hasnainz commented Dec 3, 2025

Summary

A PR based on discussion from this issue and this discussion, to consider a potential solution for modifying PoW to have better Podman support. Comments are very welcome.

This PR adds Podman support by introducing a private _BaseContainerEngineClient which is inherited by a PodmanClient and the normal DockerClient.

SystemInfo has been split into PodmanSystemInfo and DockerSystemInfo as an example of how future Podman and Docker specific changes will look in the future but can be split into a different PR if preferred.

Code Changes

  1. DockerCLICaller has been renamed to CLICaller
  2. SystemInfo has been renamed to DockerSystemInfo with a SystemInfo = DockerSystemInfo type alias
  3. PodmanSystemInfo has been added
  4. SystemCLI has been changed to _BaseSystemCLI and DockerSystemCLI and PodmanSystemCLI both inherit from it.
  5. DockerClient has been changed to _BaseContainerEngineClient and a new DockerClient inherits from it. Docker specific functionality such as BuildxCLI have been moved to the DockerClient
  6. Add a podman namepace for PodmanClient (and future podman specific things)
  7. Add a generic namespace for ContainerEngineClient (and future generic things)
  8. Add a PodmanCamelModel to handle Podman Camel Case (since its different to Docker)

Test Changes

  1. Add a native_podman_client fixture that returns PodmanClient() for testing new Podman specific interactions.
  2. Add 2 tests for testing that json is unpacked correctly into PodmanSystemInfo() and that podman.system.info() has correct values

Note: Ideally we would update the existing podman tests (and I'm happy to make these changes) such that they run twice, once for the current DockerClient(client_type='podman') and once for the native_podman_client but that will increase test time, let me know what you think.

Usage

# Existing usage unchanged
from python_on_whales import docker, DockerClient

# New podman namespace
from python_on_whales.podman import podman, PodmanClient

# New generic namespace (just a type union of DockerClient + PodmanClient for generics)
from python_on_whales.generic import ContainerEngineClient

# New Podman usage
info = podman.system.info()  # Returns PodmanSystemInfo
print(info.host.kernel)

Splitting into smaller PRs

After an quick overall review (to make sure that this PR is going in the correct direction based on the discussion) I am planning to split this PR into smaller PRs that are more easily reviewable,

@Hasnainz Hasnainz changed the title Potential better support for Podman Potential better Podman support via client inheritance Dec 3, 2025
@LewisGaul LewisGaul self-requested a review December 4, 2025 23:44
Copy link
Collaborator

@LewisGaul LewisGaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've posted some high-level design thoughts at #592 (comment) - the comments I've left relate to what I've written there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants