# podman-py
[![Build Status](https://api.cirrus-ci.com/github/containers/podman-py.svg)](https://cirrus-ci.com/github/containers/podman-py/main)
This python package is a library of bindings to use the RESTful API of [Podman](https://github.com/containers/podman).
It is currently under development and contributors are welcome!
## Dependencies
* For runtime dependencies, see [requirements.txt](https://github.com/containers/podman-py/blob/main/requirements.txt).
* For testing and development dependencies, see [test-requirements.txt](https://github.com/containers/podman-py/blob/main/test-requirements.txt).
## Example usage
```python
"""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](https://github.com/containers/podman-py/blob/main/CONTRIBUTING.md)
Raw data
{
"_id": null,
"home_page": "https://github.com/containers/podman-py",
"name": "podman",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "podman, libpod",
"author": "Brent Baude, Jhon Honce, Urvashi Mohnani, Nicola Sella",
"author_email": "jhonce@redhat.com",
"download_url": "https://files.pythonhosted.org/packages/e9/fe/076dea2614816ce55648c28634547fe7f801049bfefc87847d063cf6833e/podman-5.2.0.tar.gz",
"platform": "any",
"description": "# podman-py\n[![Build Status](https://api.cirrus-ci.com/github/containers/podman-py.svg)](https://cirrus-ci.com/github/containers/podman-py/main)\n\nThis python package is a library of bindings to use the RESTful API of [Podman](https://github.com/containers/podman).\nIt is currently under development and contributors are welcome!\n\n\n## Dependencies\n\n* For runtime dependencies, see [requirements.txt](https://github.com/containers/podman-py/blob/main/requirements.txt).\n* For testing and development dependencies, see [test-requirements.txt](https://github.com/containers/podman-py/blob/main/test-requirements.txt).\n\n## Example usage\n\n```python\n\"\"\"Demonstrate PodmanClient.\"\"\"\nimport json\nfrom podman import PodmanClient\n\n# Provide a URI path for the libpod service. In libpod, the URI can be a unix\n# domain socket(UDS) or TCP. The TCP connection has not been implemented in this\n# package yet.\n\nuri = \"unix:///run/user/1000/podman/podman.sock\"\n\nwith PodmanClient(base_url=uri) as client:\n version = client.version()\n print(\"Release: \", version[\"Version\"])\n print(\"Compatible API: \", version[\"ApiVersion\"])\n print(\"Podman API: \", version[\"Components\"][0][\"Details\"][\"APIVersion\"], \"\\n\")\n\n # get all images\n for image in client.images.list():\n print(image, image.id, \"\\n\")\n\n # find all containers\n for container in client.containers.list():\n # After a list call you would probably want to reload the container\n # to get the information about the variables such as status.\n # Note that list() ignores the sparse option and assumes True by default.\n container.reload()\n print(container, container.id, \"\\n\")\n print(container, container.status, \"\\n\")\n\n # available fields\n print(sorted(container.attrs.keys()))\n\n print(json.dumps(client.df(), indent=4))\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](https://github.com/containers/podman-py/blob/main/CONTRIBUTING.md)\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Bindings for Podman RESTful API",
"version": "5.2.0",
"project_urls": {
"Bug Tracker": "https://github.com/containers/podman-py/issues",
"Homepage": "https://github.com/containers/podman-py",
"Libpod API": "https://docs.podman.io/en/latest/_static/api.html"
},
"split_keywords": [
"podman",
" libpod"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2b64addf58bacbd3d566313003bf1edfbdaeccd0660cba13bdb3baea57b3068a",
"md5": "4eb8ee4e3f8f0a390bd9c350a6f9e22c",
"sha256": "e42e907b44af3e8578ac3bd4838040f7dd6b4af091f787e51462b979746703eb"
},
"downloads": -1,
"filename": "podman-5.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4eb8ee4e3f8f0a390bd9c350a6f9e22c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 96116,
"upload_time": "2024-09-18T14:49:56",
"upload_time_iso_8601": "2024-09-18T14:49:56.296791Z",
"url": "https://files.pythonhosted.org/packages/2b/64/addf58bacbd3d566313003bf1edfbdaeccd0660cba13bdb3baea57b3068a/podman-5.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e9fe076dea2614816ce55648c28634547fe7f801049bfefc87847d063cf6833e",
"md5": "5037538c54979f722b4b67b2f83f0455",
"sha256": "6a064a3e9dbfc4ee0ee0c51604164e1f58d9d00b10f702c3e570651aee722ec7"
},
"downloads": -1,
"filename": "podman-5.2.0.tar.gz",
"has_sig": false,
"md5_digest": "5037538c54979f722b4b67b2f83f0455",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 80420,
"upload_time": "2024-09-18T14:49:58",
"upload_time_iso_8601": "2024-09-18T14:49:58.220292Z",
"url": "https://files.pythonhosted.org/packages/e9/fe/076dea2614816ce55648c28634547fe7f801049bfefc87847d063cf6833e/podman-5.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-18 14:49:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "containers",
"github_project": "podman-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "podman"
}