Skip to main content

Reusable workflow blocks for CUTIP — container, SSH, k8s, file, and more

Project description

cutip-blocks

Python 3.11+ License: MIT cutip

Reusable workflow blocks for CUTIP — Container Unit Templates in Python.

Each block is a decorated Python function that maps to a single CLI operation (kubectl, ssh, cp, etc.). Blocks execute at runtime and provide metadata for cutip-desktop DAG visualization.

Installation

pip install cutip-blocks

Block Categories

Category Blocks Maps to
container start, stop, remove, exec, exec_stream podman/docker
ssh session, exec, probe ssh/paramiko
file copy, copy_tree, read_yaml, write_yaml, read_json, write_json, replace, is_empty filesystem
k8s get_deployment, get_secret, get_pod, exec, cp, apply, patch_deployment, rollout_status kubectl
crictl image_ls, image_rm, image_import crictl/ctr
download http_fetch HTTP GET
config render_template, substitute_vars template rendering
validate path_exists, env_var_set, ip_valid precondition checks
service poll_until_ready, wait_for_exit readiness polling

Usage

from cutip.workflow import action, orchestrator, stage
from cutip_blocks.blocks import container, ssh, k8s

@action(name="Check Deployment")
def check_deploy(ctx, sesh, ns, deploy):
    k8s.get_deployment(ctx, sesh, namespace=ns, deployment=deploy)

@orchestrator
def main(ctx):
    container.start(ctx, container="my-app")

    with ssh.session(ctx, container="my-app",
                     host="10.0.0.1", username="root",
                     password=ctx.config["password"]) as sesh:

        stage("Validation")
        check_deploy(ctx, sesh, "default", "web")

        stage("Operations")
        k8s.apply(ctx, sesh, file="/tmp/patch.yaml")

    container.stop(ctx, container="my-app")

SSH Session

All SSH-based blocks share a persistent connection via context manager. One SSH handshake, reused for all commands. Credentials are redacted in all log output.

INFO | [Get Deployment] ssh root@10.0.0.1 :: kubectl get deployment -n default web -o name
INFO | [Get Secret] ssh root@10.0.0.1 :: kubectl get secret -n ns creds -o name

Block Discovery

from cutip_blocks import BlockRegistry

registry = BlockRegistry.discover()
for meta, fn in registry.blocks:
    print(f"{meta.category}.{meta.action}{meta.name}")

License

MIT

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

cutip_blocks-0.2.0.tar.gz (89.5 kB view details)

Uploaded Source

Built Distribution

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

cutip_blocks-0.2.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file cutip_blocks-0.2.0.tar.gz.

File metadata

  • Download URL: cutip_blocks-0.2.0.tar.gz
  • Upload date:
  • Size: 89.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cutip_blocks-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b5efbc247aa871aa8713c1cf5238b7d1d540909a6f486e1fca3b4b979f8f2478
MD5 493a3c5316b2e1223072b6533a28ccd2
BLAKE2b-256 974f06d9bfae7e7440381a3bf31e9854c1acf9001d4e7bee33c87c0c2ae34578

See more details on using hashes here.

File details

Details for the file cutip_blocks-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cutip_blocks-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cutip_blocks-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4236b9aafee7942d63cd27bca663b03a7009ce4aeae8908208f21c4429d65968
MD5 a87d77b9b0ab2b11a7deca20abcd71b5
BLAKE2b-256 822e55b1c49171e4f23566ae7831eaf89547fecd1ae119b2004de0766f0ae9c1

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