Skip to main content

Bindings for Podman RESTful API

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

podman-5.8.0.tar.gz (121.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

podman-5.8.0-py3-none-any.whl (94.5 kB view details)

Uploaded Python 3

File details

Details for the file podman-5.8.0.tar.gz.

File metadata

  • Download URL: podman-5.8.0.tar.gz
  • Upload date:
  • Size: 121.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for podman-5.8.0.tar.gz
Algorithm Hash digest
SHA256 bc39b77f4a6a0598bbe860d199e0d54ef2ec551131ae7eab66f0557c43331fb3
MD5 f005da26e102bc754fdc5e0c92209aa5
BLAKE2b-256 18f1ea8988ff2085d1a898f7f27b7fa26a5b5e296949c6ef4df26ebc2be1aac0

See more details on using hashes here.

Provenance

The following attestation bundles were made for podman-5.8.0.tar.gz:

Publisher: publish-to-pypi.yml on containers/podman-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file podman-5.8.0-py3-none-any.whl.

File metadata

  • Download URL: podman-5.8.0-py3-none-any.whl
  • Upload date:
  • Size: 94.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for podman-5.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c0383386fc926e15b58890a727d8bb53b0c42730a5c610db391bfd20310ceeb
MD5 f0f16f3cc761689a0214bd472cf9bd6f
BLAKE2b-256 1e0a648704ca7f70a44a407b556eda86fccd8cafcb060de90c884d66a7389f36

See more details on using hashes here.

Provenance

The following attestation bundles were made for podman-5.8.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on containers/podman-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page