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.4.3-cp313-cp313-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.13Windows x86-64

rsty-0.4.3-cp313-cp313-manylinux_2_39_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

rsty-0.4.3-cp313-cp313-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rsty-0.4.3-cp313-cp313-macosx_10_12_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rsty-0.4.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 3.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.4.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 df0633d1b6f1a1b398fbc56e475f00ba63e7bba7889986f4d8fb61cf32f47e99
MD5 c43795a1f0e32e2a400c629e69343d43
BLAKE2b-256 d42c0169205edb4244562dae0194ccee850ff1b498b6bc97597bf9f94ce8322c

See more details on using hashes here.

File details

Details for the file rsty-0.4.3-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for rsty-0.4.3-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 9aded658c82e4a5a1633e8e479358c37eb0d3abd523efb74584ead554ad81640
MD5 e520ba6c55c100e0da9676094e3c32c9
BLAKE2b-256 0745626e1ffc9a14f37235774a46711b08bb91b7fed0747484e4cb3debc3d85b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rsty-0.4.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 762007988a64657870dd8482c36f0e317c760e07e5d8ac69879dff5e3190606f
MD5 7717db38646f4e064a2e3a8dd834e8d4
BLAKE2b-256 55ce8c4af65a7a6cd8e016b61d259c9b8747cd3bd6421d8fa300681dddb833ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rsty-0.4.3-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2e9f96c0042caa0a7148a9fdea8e8abe2de6989b4d3a7973ac2a5527f09b4d92
MD5 51f5238b38896a966269291ec6327c94
BLAKE2b-256 4d57ef511210a981b67e056f52d10eb91fbc4f30e0118ff55e24c328b48fd528

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