Skip to content

feat(inspect): implement python-native skopeo inspect #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

whatsacomputertho
Copy link
Collaborator

@whatsacomputertho whatsacomputertho commented May 12, 2025

In this PR, I begin to implement a python-native equivalent of skopeo inspect. I develop the following changes in support of this:

  • The ContainerImageInspect class, which represents the output of skopeo inspect
  • The inspectschema.py source file, with the JSON Schema for validating a ContainerImageInspect dict
  • In the ContainerImagePlatform class, a new static method for getting the host platform
    • With environment variable overrides for the os (HOST_OS) and arch (HOST_ARCH)
  • In the ContainerImage class, new methods for
    • Fetching the ContainerImageConfig for the image
    • Given a manifest, getting the host platform manifest if it is a manifest list, else raising an exception
    • Using the ContainerImageConfig and host platform manifest to construct and return a ContainerImageInspect instance

I finally write a new example script examples/image-inspect.py to quickly validate this new functionality against a test image. I am on darwin/amd64 so to run the example I just simply run the following from the root directory of this repository:

HOST_OS=linux python3.9 examples/image-inspect.py

For reference, see:

@whatsacomputertho
Copy link
Collaborator Author

FYI @cmoulliard

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.

1 participant