Skip to main content

A python library for ineracting with container images and container image registries

Project description

containerimage-py

containerimage-py

Test Sec Doc Build

A python library for interacting with container images and container image registries

Docs: https://containers.github.io/containerimage-py/

Contributing: CONTRIBUTING.md

Quick Example

Here is a quick motivating example for how you might use containerimage-py in your python scripts to fetch basic information about a container image.

from image.containerimage import ContainerImage

# Initialize a ContainerImage given a tag reference
my_image = ContainerImage("registry.k8s.io/pause:3.5")

# Display some basic information about the container image
print(
    f"Size of {str(my_image)}: " + \
    my_image.get_size_formatted(auth={}) # 499.91 MB
)
print(
    f"Digest for {str(my_image)}: " + \
    my_image.get_digest(auth={}) # sha256:1ff6c18fbef2045af6b9c16bf034cc421a29027b800e4f9b68ae9b1cb3e9ae07
)

# Inspect the container image image for a more consolidated summary
print(
    f"Inspect for {str(my_image)}:\n" + \
    str(my_image.inspect(auth={})) # Same as skopeo inspect docker://registry.k8s.io/pause:3.5
)

To run this example, simply execute the following from the root of this repository

python3 examples/quick-example.py

Installation

Using Pip

Run the following command to install the latest version of this package

pip install containerimage-py

Local Install

  1. Clone this repository
  2. Build the project from source
  3. Locate the .whl (wheel) file in the dist folder
    • It should be named something like so: containerimage_py-1.0.1-py3-none-any.whl
  4. Run the following command from the root of the repository, replacing the name of the .whl file if necessary
    pip install dist/containerimage_py-1.0.1-py3-none-any.whl
    

Build

From the root of this repository, execute

make build

Under the hood, this will execute python3 -m build and produce a .whl (wheel) and .tgz (TAR-GZip archive) file in the dist subdirectory. For more on this project's make recipes, 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

containerimage_py-1.0.1.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

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

containerimage_py-1.0.1-py3-none-any.whl (51.4 kB view details)

Uploaded Python 3

File details

Details for the file containerimage_py-1.0.1.tar.gz.

File metadata

  • Download URL: containerimage_py-1.0.1.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for containerimage_py-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8084375efca5a656f2b8d79b693e615233447f686b0896aad4f8970a83191c4c
MD5 fa6c47ae9f4a05cfa9ef1a78c8b4eb7b
BLAKE2b-256 898d6aed4e8b6a556ae80008a9b4a47b39531c8564bddeccc229a28723d7c577

See more details on using hashes here.

File details

Details for the file containerimage_py-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for containerimage_py-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db1acbdeab56394e8a3b041862fa77d72756b84d64b4bd8151ea22e8bd09e78a
MD5 4bd5df9a2fb12088d123814ab06a531c
BLAKE2b-256 5bf80ebe5d51e2a44246281d12bbd60f054f03bb13d06507057a8df5935818b3

See more details on using hashes here.

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