Skip to main content

Versioned kpack models for cloudcoil

Project description

cloudcoil-models-kpack

Versioned kpack models for cloudcoil.

[!WARNING]
This repository is auto-generated from the cloudcoil repository. Please do not submit pull requests here. Instead, submit them to the main repository at https://github.com/cloudcoil/cloudcoil.

🔧 Installation

[!NOTE] For versioning information and compatibility, see the Versioning Guide.

Using uv (recommended):

# Install with kpack support
uv add cloudcoil.models.kpack

Using pip:

pip install cloudcoil.models.kpack

💡 Examples

Using kpack Models

from cloudcoil import apimachinery
import cloudcoil.models.kpack.v1alpha2 as kpack
import cloudcoil.models.kpack.core as core
import cloudcoil.models.kubernetes.core.v1 as k8score

# Create an Image resource
image = kpack.Image(
    metadata=apimachinery.ObjectMeta(name="my-app"),
    spec=kpack.ImageSpec(
        tag="registry.example.com/my-app",
        builder_=k8score.ObjectReference(
            name="my-builder",
            kind="ClusterBuilder"
        ),
        source=core.SourceConfig(
            git=core.Git(
                url="https://github.com/my-org/my-app.git",
                revision="main"
            )
        )
    )
).create()

# Create a Builder
builder = kpack.BuilderResource(
    metadata=apimachinery.ObjectMeta(name="my-builder"),
    spec=kpack.BuilderSpec(
        tag="registry.example.com/builder",
        stack=k8score.ObjectReference(
            name="base",
            kind="ClusterStack"
        ),
        store=k8score.ObjectReference(
            name="default",
            kind="ClusterStore"
        )
    )
).create()

# List Images
for img in kpack.Image.list():
    print(f"Found image: {img.metadata.name}")

# Update an Image
image.spec.source.git.revision = "v1.0.0"
image.save()

# Delete resources
kpack.Image.delete("my-app")
kpack.BuilderResource.delete("my-builder")

Using the Fluent Builder API

from cloudcoil.models.kpack.v1alpha2 import Image

# Create an Image using the fluent builder
image = (
    Image.builder()
    .metadata(lambda m: m
        .name("my-app")
        .namespace("default")
    )
    .spec(lambda s: s
        .tag("registry.example.com/my-app")
        .builder_(lambda b: b
            .name("my-builder")
            .kind("ClusterBuilder")
        )
        .source(lambda src: src
            .git(lambda g: g
                .url("https://github.com/my-org/my-app.git")
                .revision("main")
            )
        )
    )
    .build()
)

Using the Context Manager Builder API

from cloudcoil.models.kpack.v1alpha2 import Image, BuilderResource

# Create an image using context managers
with Image.new() as app_image:
    with app_image.metadata() as metadata:
        metadata.name("my-app")
        metadata.namespace("default")
    
    with app_image.spec() as spec:
        spec.tag("registry.example.com/my-app")
        
        with spec.builder_() as builder:
            builder.name("my-builder")
            builder.kind("ClusterBuilder")
        
        with spec.source() as source:
            with source.git() as git:
                git.url("https://github.com/my-org/my-app.git")
                git.revision("main")

final_image = app_image.build()

# Create a builder using context managers
with BuilderResource.new() as builder:
    with builder.metadata() as metadata:
        metadata.name("my-builder")
        metadata.namespace("default")
    
    with builder.spec() as spec:
        spec.tag("registry.example.com/builder")
        
        with spec.stack() as stack:
            stack.name("base")
            stack.kind("ClusterStack")
        
        with spec.store() as store:
            store.name("default")
            store.kind("ClusterStore")
        
        # Add buildpacks to the builder
        with spec.buildpacks() as buildpacks:
            with buildpacks.add() as pack:
                pack.id("paketo-buildpacks/java")
                pack.version("3.0.0")

final_builder = builder.build()

The context manager builder provides:

  • 🎭 Clear visual nesting of resource structure
  • 🔒 Automatic resource cleanup
  • 🎯 Familiar Python context manager pattern
  • ✨ Same great IDE support as the fluent builder

📚 Documentation

For complete documentation, visit cloudcoil.github.io/cloudcoil

📜 License

Apache License, Version 2.0 - see LICENSE

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

cloudcoil_models_kpack-0.16.1.1.tar.gz (94.7 kB view details)

Uploaded Source

Built Distribution

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

cloudcoil_models_kpack-0.16.1.1-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file cloudcoil_models_kpack-0.16.1.1.tar.gz.

File metadata

File hashes

Hashes for cloudcoil_models_kpack-0.16.1.1.tar.gz
Algorithm Hash digest
SHA256 6e778db6c1534c2b07325221bac7dec6ad877ef369076a1eb3361953cb91a076
MD5 e881c750b9fe114474f872bf4c072099
BLAKE2b-256 244748c11de84332bcb3f4c65e46b5d83732cc4dc19c49ed4794c6c5f2cdfc4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cloudcoil_models_kpack-0.16.1.1.tar.gz:

Publisher: pypi_publish.yml on cloudcoil/models-kpack

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

File details

Details for the file cloudcoil_models_kpack-0.16.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudcoil_models_kpack-0.16.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3db533a9c53ea5cd2d5876a19ddf00f518cc76ad147da3af8dec09a10dffdcc
MD5 f8214f9d3198f95e2edad40dafaf566f
BLAKE2b-256 015fe950c61826f89ccf959211a0b823c498b2d8b043f9f101ab27d1f681a939

See more details on using hashes here.

Provenance

The following attestation bundles were made for cloudcoil_models_kpack-0.16.1.1-py3-none-any.whl:

Publisher: pypi_publish.yml on cloudcoil/models-kpack

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