Skip to main content

Python-typed Rust modules for workflow automation — SSH, containers, files, HTTP, packages, services, templates

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.

rsty-0.8.0-cp313-cp313-win_amd64.whl (4.7 MB view details)

Uploaded CPython 3.13Windows x86-64

rsty-0.8.0-cp313-cp313-manylinux_2_34_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

rsty-0.8.0-cp313-cp313-macosx_11_0_arm64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rsty-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

File details

Details for the file rsty-0.8.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rsty-0.8.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 4.7 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rsty-0.8.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8e8e3f732b94cf9968ce99d95254be93f14e1385382163f15da8af30676fea59
MD5 4ba9439f2b0c35b7ff11f4e0a58a9a3f
BLAKE2b-256 3cc679965d40de0aa4d3a5bc930a8e0581f510b62348e9d28bd7aabb6785cea9

See more details on using hashes here.

File details

Details for the file rsty-0.8.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rsty-0.8.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6e2b4e6d5dcb5d829dc3e9698e6b50f0e747a6e7b33c1816b074e5507b43742f
MD5 0556c3187b360f79e1cf0809586a9d63
BLAKE2b-256 80d44247b010cd7e070b67423782a0ff3ea06fcc0bc0f4c068f449b7e27c8ba8

See more details on using hashes here.

File details

Details for the file rsty-0.8.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rsty-0.8.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e2aea4d3c53cdeba987055407f6263e08ec8d0d4398b8e8ce9cc5a1fbdfb1639
MD5 4eb4a0a6571e792c94a1114427a75dd7
BLAKE2b-256 14c06ec9e71d5de1b979fc1d92141c57cd5a1eaf1d9dd4450c5cfb7af0f37c6a

See more details on using hashes here.

File details

Details for the file rsty-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rsty-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fc9c3c612e6921f8f96dac7ff6e52a6bb4c3da90857aeb3046c679511c0c0aa6
MD5 6e5aab37598a7783d3038cdbb18e908a
BLAKE2b-256 aa750e6abed115e4d20b94a27a2fb2a2591c7a624045e97b9d2c2d8a83fe4f38

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