dkdc-sh
Shell library.
Install
cargo add dkdc-sh
uv add dkdc-sh
Usage
Rust
use dkdc_sh::{which, require, run, run_with_env, tmux, git};
// Command checking
if which("tmux").is_some() { /* ... */ }
require("git")?;
// Run arbitrary commands
let output = run("echo", &["hello"])?;
// Run with custom environment variables
let output = run_with_env("cargo", &["build"], &[("RUSTFLAGS", "-D warnings")])?;
// Tmux session management
tmux::new_session("my-service", "python server.py")?;
tmux::send_keys("my-service", "reload")?;
let logs = tmux::capture_pane("my-service", Some(50))?;
tmux::kill_session("my-service")?;
// Git operations
git::clone_shallow("https://github.com/org/repo.git", &dest, "main")?;
git::clone_shallow_with_env(
"https://github.com/org/repo.git", &dest, "main",
&[("GIT_SSH_COMMAND", "ssh -i ~/.ssh/deploy_key")],
)?;
git::checkout_new_branch(&repo_dir, "feature/branch")?;
git::config_set(&repo_dir, "user.email", "bot@example.com")?;
let log = git::cmd_with_env(&repo_dir, &["log", "--oneline"], &[("GIT_PAGER", "cat")])?;
Python
import dkdc_sh
# Command checking
path = dkdc_sh.which("tmux")
dkdc_sh.require("git")
# Run commands
output = dkdc_sh.run("echo", ["hello"])
# Run with custom environment variables
output = dkdc_sh.run("cargo", ["build"], env=[("RUSTFLAGS", "-D warnings")])
# Tmux
dkdc_sh.tmux_new_session("my-service", "python server.py")
dkdc_sh.tmux_send_keys("my-service", "reload")
logs = dkdc_sh.tmux_capture_pane("my-service", lines=50)
dkdc_sh.tmux_kill_session("my-service")
# Git
dkdc_sh.git_clone_shallow("https://github.com/org/repo.git", "./dest", "main")
dkdc_sh.git_checkout_new_branch("./repo", "feature/branch")
output = dkdc_sh.git_cmd("./repo", ["log", "--oneline"])
Error handling
Rust
The library uses a unified Error enum:
| Variant | Description |
|---|---|
CommandNotFound |
Command not found in PATH |
CommandFailed |
Non-zero exit code (includes stderr) |
Tmux |
Tmux-specific errors |
Io |
IO errors |
Python
All errors are raised as RuntimeError.
Metadata
Release files for dkdc-sh 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dkdc_sh-0.2.2.tar.gz | 10.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| dkdc_sh-0.2.2-cp311-abi3-manylinux_2_39_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.39+ x86-64 | Details |
| dkdc_sh-0.2.2-cp311-abi3-manylinux_2_39_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.39+ ARM64 | Details |
| dkdc_sh-0.2.2-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details |
| dkdc_sh-0.2.2-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 1.1 MB
Release files / dkdc_sh-0.2.2.tar.gz
| Download URL | dkdc_sh-0.2.2.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d895f3e0768c0cc7610e0b92b522aa3b548d25d43705f620a56fc7182c392e8
|
|
BLAKE2b-256 checksum How to use checksums |
f08335f60eeb1c220626804f3698802ed38040efe0615310d858f90edb3e3fc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2026.
Transparency logRelease files / dkdc_sh-0.2.2-cp311-abi3-manylinux_2_39_x86_64.whl
| Download URL | dkdc_sh-0.2.2-cp311-abi3-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 299.4 kB |
| Tags | CPython 3.11 Linux glibc 2.39+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4a1d56bb11bdc5a71be792c2de273e52aa0a1c6a47aaeddf3fdf0efe991ea8a8
|
|
BLAKE2b-256 checksum How to use checksums |
aba8309a47ad8d569c300828b271807f909fc49f279d883437b4480fe63d867d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2026.
Transparency logRelease files / dkdc_sh-0.2.2-cp311-abi3-manylinux_2_39_aarch64.whl
| Download URL | dkdc_sh-0.2.2-cp311-abi3-manylinux_2_39_aarch64.whl |
|---|---|
| Size | 289.8 kB |
| Tags | CPython 3.11 Linux glibc 2.39+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
83b5989c2a23b7293982ad707c9b4cb8db8ebc1da58ea40ded3aba089223ba3f
|
|
BLAKE2b-256 checksum How to use checksums |
a8b2aedebe34337667105211ccd1f1b3c6091e002702eaf3f62fc93429bfcc77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2026.
Transparency logRelease files / dkdc_sh-0.2.2-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | dkdc_sh-0.2.2-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 255.3 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0eaaf08eb432f861453dfbab08c8904e40b24810ff4b293514c004a490787b68
|
|
BLAKE2b-256 checksum How to use checksums |
9eb87e7f063034e77d86e0e951996691bc9b0511f24bdac9e9b420e5cb950050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2026.
Transparency logRelease files / dkdc_sh-0.2.2-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | dkdc_sh-0.2.2-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 263.4 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f57406cae2a86e8324c83c104bfc7c496aabf9105e81b252e1e6055a9ae57fb6
|
|
BLAKE2b-256 checksum How to use checksums |
318b197a45c4e29a24a11e00a7a2f5d7300e064a687c3acd52ec152ed4f004a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2026.
Transparency log