Python bindings for Podman's RESTful API
Go to file
Nicola Sella bfc70e666f
Bump release to 5.5.0 (pyproject.toml fix)
Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-06-18 12:49:23 +02:00
.fmf Onboard TMT 2025-01-29 16:10:30 +01:00
.github Set verbose: true to debug twine uploads to PypI 2025-02-24 10:06:05 +01:00
contrib cirrus: replace dnf command 2024-12-13 16:43:32 +01:00
docs/source Fix Pyupgrades 2025-01-28 15:42:15 +01:00
hack
plans Enable Updates Testing repositories 2025-05-14 18:06:37 +02:00
podman Merge pull request #549 from inknos/5.5.0 2025-06-17 15:55:13 +00:00
rpm Fix Pyupgrades 2025-01-28 15:42:15 +01:00
tests Improve testing against distro and podman-next 2025-05-05 15:48:40 +02:00
.gitignore [CI:BUILD] Packit: initial enablement 2023-06-05 16:06:08 -04:00
.packit.yaml Improve testing against distro and podman-next 2025-05-05 15:48:40 +02:00
.pre-commit-config.yaml fix pre commit hook 2025-04-15 10:44:52 +02:00
.pylintrc Update files to adhere to new lint requirements 2023-02-07 11:46:58 -05:00
.readthedocs.yaml Use extra requirements to build readthedocs 2025-05-06 14:48:38 +02:00
CODE-OF-CONDUCT.md [CI:DOCS] Fix docs links due to branch rename 2021-06-14 14:27:57 -04:00
CONTRIBUTING.md Improve testing against distro and podman-next 2025-05-05 15:48:40 +02:00
LICENSE
Makefile Bump release to 5.5.0 2025-05-14 17:54:42 +02:00
OWNERS Add edward5hen as reviewer 2024-12-12 10:47:16 -07:00
README.md Remove Cirrus testing 2025-05-06 10:49:43 +02:00
SECURITY.md [CI:DOCS] Fix docs links due to branch rename 2021-06-14 14:27:57 -04:00
gating.yml Enable tmt downstream 2025-03-05 17:07:42 +01:00
mkdocs.yml
podman.svg Revert pyproject.toml requires changes 2021-09-17 09:11:38 -07:00
pyproject.toml Bump release to 5.5.0 (pyproject.toml fix) 2025-06-18 12:49:23 +02:00
setup.cfg Bump release to 5.5.0 2025-05-14 17:54:42 +02:00
setup.py Update CI to fail on Podman 4.0 errors 2022-02-28 09:07:48 -07:00
tox.ini misc: add mypy for type checking 2025-04-15 10:18:53 +02:00

README.md

podman-py

PyPI Latest Version

This python package is a library of bindings to use the RESTful API of Podman. It is currently under development and contributors are welcome!

Installation

pip install podman

Documentation: https://podman-py.readthedocs.io/en/latest/

Source Code: https://github.com/containers/podman-py


Dependencies

  • For runtime dependencies, see [dependencies] in pyproject.toml
  • For testing and development dependencies, see [project.optional.dependencies] in pyproject.toml
    • The package is split in [progress_bar], [docs], and [test]

Example usage

"""Demonstrate PodmanClient."""
import json
from podman import PodmanClient

# Provide a URI path for the libpod service.  In libpod, the URI can be a unix
# domain socket(UDS) or TCP.  The TCP connection has not been implemented in this
# package yet.

uri = "unix:///run/user/1000/podman/podman.sock"

with PodmanClient(base_url=uri) as client:
    version = client.version()
    print("Release: ", version["Version"])
    print("Compatible API: ", version["ApiVersion"])
    print("Podman API: ", version["Components"][0]["Details"]["APIVersion"], "\n")

    # get all images
    for image in client.images.list():
        print(image, image.id, "\n")

    # find all containers
    for container in client.containers.list():
        # After a list call you would probably want to reload the container
        # to get the information about the variables such as status.
        # Note that list() ignores the sparse option and assumes True by default.
        container.reload()
        print(container, container.id, "\n")
        print(container, container.status, "\n")

        # available fields
        print(sorted(container.attrs.keys()))

    print(json.dumps(client.df(), indent=4))

Contributing

See CONTRIBUTING.md