Skip to main content

Reusable workflow blocks for CUTIP — Rust-backed via PyO3

Project description

cutip-blocks

Python 3.11+ Rust License: MIT

Rust-backed workflow blocks for CUTIP. Write Python, execute Rust.

Every function you call from cutip_blocks is a compiled Rust binary under the hood — SSH via russh, Docker/Podman via bollard, HTTP via reqwest, YAML/JSON via serde. Zero Python dependencies. The Python GIL is released during all I/O.

Install

pip install cutip-blocks

Modules

Module Rust crate What it does
ssh russh Persistent SSH sessions — connect(), exec(), probe()
kubectl serde Kubernetes ops over SSH — get, exec, find_pod, patch_deployment, patch_file_from_pod
container bollard Docker/Podman — start, stop, remove, exec, pull
file std::fs + serde copy, copy_tree, read/write_json, read/write_yaml, replace
http reqwest get, post, put, delete with JSON + TLS toggle
network bollard create, remove, exists
service reqwest + bollard poll_until_ready, wait_for_exit
validate std path_exists, env_var_set, ip_valid
config string ops render_template, substitute_vars

Usage

SSH + kubectl (remote VM operations)

from cutip_blocks import ssh, kubectl

with ssh.connect(host="10.0.0.1", username="root", password=pw) as sesh:
    sesh.probe()  # verify connectivity

    kube = kubectl.connect(sesh, namespace="prod")
    kube.get("deployment", name="web")
    kube.find_pod(name_prefix="web")

    password = kube.get_secret_value(secret="db-creds", key="password")
    kube.exec(target="deploy/web", cmd="cat /app/config.py")

    kube.patch_file_from_pod(
        deployment="web",
        source_file="/opt/app/handler.py",
        dest_dir="/root/patches",
        replacements={"old_value": "new_value"},
    )

    kube.patch_deployment(
        deployment="web",
        volume_name="config-override",
        host_path="/root/patches/handler.py",
        mount_path="/opt/app/handler.py",
    )

Container management

from cutip_blocks import container

rt = container.connect()  # auto-detect Docker/Podman
rt.pull("nginx", tag="latest")
rt.start("my-container")
result = rt.exec("my-container", "nginx -t")
print(result.stdout)
rt.stop("my-container")
rt.remove("my-container")

File operations

from cutip_blocks import file

data = file.read_json("config.json")
file.copy_tree("src/", "build/deps/")
file.replace("config.yaml", "old_value", "new_value")
file.write_yaml("output.yaml", {"key": "value"})

HTTP

from cutip_blocks import http

resp = http.post("https://api.example.com/token",
                 json={"username": "admin", "password": "secret"},
                 verify_tls=False)
token = resp.json()["access_token"]

Development

Requires Rust toolchain + Python 3.11+.

git clone https://github.com/joshuajerome/cutip-blocks.git
cd cutip-blocks
python -m venv .venv && source .venv/bin/activate
pip install maturin pytest
maturin develop
pytest tests/ -v

Ecosystem

Project Description
cutip Workflow automation framework
cutip-blocks Rust-backed blocks (this repo)
cutip-desktop Visual companion — DAG, container management

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

cutip_blocks-0.3.4-cp313-cp313-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.13Windows x86-64

cutip_blocks-0.3.4-cp313-cp313-manylinux_2_38_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.38+ x86-64

cutip_blocks-0.3.4-cp313-cp313-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cutip_blocks-0.3.4-cp313-cp313-macosx_10_12_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

File details

Details for the file cutip_blocks-0.3.4-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for cutip_blocks-0.3.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9afc229ac3c445e524c959093837fb96401730c0389affc75b20864459c49a0e
MD5 d8c0aac5772481b0575c7de0d78ae20d
BLAKE2b-256 0eb21529490da7c89437ed2ca8ce7bdadac7494b023db8197171284503dd06e1

See more details on using hashes here.

File details

Details for the file cutip_blocks-0.3.4-cp313-cp313-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for cutip_blocks-0.3.4-cp313-cp313-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 89d531002ebc10118e3439b444041c734bf20d7a0e126ba8b758b14d4a87f401
MD5 e3b3dd25af668ad94de47bf8562568ca
BLAKE2b-256 1d79edb16cb65f22e87fc485517d7bbc9446e1ecbd11c8e0089176f118a9c67e

See more details on using hashes here.

File details

Details for the file cutip_blocks-0.3.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cutip_blocks-0.3.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0fbf9e5c65e098356ea8ca61d2c4f85bc20e32e00b5de569b26433aa5c9ed258
MD5 072545692b0db1046d7f7ee162a2e1cf
BLAKE2b-256 561187c456d4f120afd5547cc37bef88afede7cea5af9849740c2f873a32db71

See more details on using hashes here.

File details

Details for the file cutip_blocks-0.3.4-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cutip_blocks-0.3.4-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b22e01730382c58caf02745016816fe046fde12c6478c66a5ae8d541ab61456d
MD5 acd3832abe18a279ceac97c8246ea497
BLAKE2b-256 ddf18b078eaf7639bd1654c21353857334ef2ebc7a63e0662db6cdfc12d5ebe3

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