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.1.tar.gz (91.9 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.1-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cutip_blocks-0.2.1.tar.gz
  • Upload date:
  • Size: 91.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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.1.tar.gz
Algorithm Hash digest
SHA256 6180016255a4f0df0358520993c0b7b7af95502271aa3c4cc2636f2a23fb431c
MD5 f96677279187b28d523edeb6fac8317f
BLAKE2b-256 204a9583541b95a5ff8da732693abc4a54c7a5b29aa6704bf1dabbaec8aa1286

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cutip_blocks-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 53e7946ece8e65f7c96e6191b415a16c186b9a8a73fb06b8f8a4612170f489b3
MD5 c9d9cdd4843ad68b8b3bd140269d71d5
BLAKE2b-256 93d5b8aad52e5d3f9608319b75b4e93992374ee568d07d09b8b2c25b466631c2

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