Reusable workflow blocks for CUTIP — Rust-backed via PyO3
Project description
cutip-blocks
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cutip_blocks-0.6.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: cutip_blocks-0.6.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 3.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ab4e6d503693baa9e42fb6269701ab1ea78f178bc7e8182deb06c95d3f3eb0c
|
|
| MD5 |
df3356d35a03660a6afd87d909da96c8
|
|
| BLAKE2b-256 |
b482c7d00d698fec4efd34f3d8d0193fe1bab67e49ca46cda4677ed7d7a0fbe9
|
File details
Details for the file cutip_blocks-0.6.0-cp313-cp313-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: cutip_blocks-0.6.0-cp313-cp313-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 5.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcf673b869385967d09775cc99f7414256c03196952e6c676493663af0c14c60
|
|
| MD5 |
66211a726db5f055718788bc44a50690
|
|
| BLAKE2b-256 |
551367c1d4f6e2366b3ebf7a160359d2eb35c5157bf393c9f3b5b87270cd44ef
|
File details
Details for the file cutip_blocks-0.6.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: cutip_blocks-0.6.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47d63c97ad6c5f5d0e0e7d65a7467e6f4db3376d01b1aa657ac066190f3a6588
|
|
| MD5 |
03cde6d306175d37f0bfda83053018a2
|
|
| BLAKE2b-256 |
b9d4722b676aef1efc97c4afdab8b3a50b991a30214c882e0adbae4a726b5bf8
|
File details
Details for the file cutip_blocks-0.6.0-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: cutip_blocks-0.6.0-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8263d1cc02910480245232fb96f32a1980a780c34512258dbf19d5ffcbd74b5d
|
|
| MD5 |
367e9f52516995d739fcbcacce0cfba3
|
|
| BLAKE2b-256 |
30941d10f1fea69407f72c98609af0ce831f2b18dcdf1893b30b39e8ebdd3897
|