Skip to main content

Fluent Python SDK and shell for Linux server operations

Project description

ServerKit

A fluent Python SDK and shell for Linux server operations.

Inspect processes, logs, disk, services, and more through chainable objects and saved workflows — instead of memorizing ps, grep, and one-off shell pipelines. Run commands interactively in the REPL, automate in scripts, or ask questions in plain English with local Ollama.

Version 0.3.5 · Python 3.10+ · Linux

pip install "serverkit[rich]"

serverkit on PyPI · User guide · Examples


Why ServerKit

Instead of… ServerKit gives you…
ps aux | awk … | grep … server.processes().memory_above(500).sort_by_memory().summarize()
Ad-hoc audit scripts you rewrite every time Named workflows in ~/.serverkit/workflows/, importable from a built-in catalog
SSH + shell one-liners per host Server.connect("host") with the same API locally and remotely
Piping logs through grep and tail server.logs("app.log").errors().match(r"timeout").summarize()

Filters run eagerly; .summarize(), .display(), and .all() are terminal — you always know when work is done.


Install

Recommended (SDK + interactive shell + formatted tables):

pip install "serverkit[rich]"

Everything (SSH remote, Docker, AI, Rich):

pip install "serverkit[all]"
Extra Adds
[rich] Formatted tables for .display() and the REPL
[remote] Server.connect() / REPL connect over SSH
[docker] Container listing, logs, and stats
[ai] Server.ask() and REPL ask … via Ollama
[dev] pytest and test dependencies

Core install (pip install serverkit) includes the SDK and REPL with plain-text .summarize() output. For the full interactive experience, use at least [rich].

After install, launch the shell:

serverkit

Config is created automatically at ~/.serverkit/config.json on first use (commented template — edit values or uncomment optional lines).


Quick start

Python SDK

from serverkit import Server

server = Server()

# Processes and memory
print(server.processes().memory_above(500).sort_by_memory().summarize())
print(server.memory().summarize())

# Logs
print(server.logs("/var/log/syslog").errors().tail(50).summarize())

# Disk and services
print(server.disk().usage_above(80).summarize())
print(server.systemctl().list_units().active().summarize())

# Workflows — import a catalog template and run it
server.import_workflow("memory_audit")
server.run("memory_audit")

# Or build and save your own
server.workflow("audit").processes().memory_above(1000).summarize().save()
server.run("audit", dry_run=True)

Remote hosts

Requires [remote]:

from serverkit import Server

with Server.connect("vm1.example", user="deploy", key_path="~/.ssh/id_ed25519") as remote:
    print(remote.processes().memory_above(200).summarize())
    print(remote.memory().summarize())
    remote.service("nginx").status()
    remote.run("memory_audit")

Interactive shell

serverkit
help
memory
processes().memory_above(500).summarize()
catalog
import memory_audit
run memory_audit
connect vm1.example --user deploy --key ~/.ssh/id_ed25519
disconnect
exit

Natural language (optional)

Requires [ai] and a running Ollama instance:

from serverkit import Server
print(Server().ask("show processes with cpu above 10 percent"))
ask list processes with cpu above 10 percent
ask largest files in /var/log limit 10

The AI layer routes requests through the SDK — it does not execute arbitrary shell from the model. Common phrases like CPU/memory thresholds use deterministic parsing so small models stay reliable.


What's included

  • Resource facades — processes, logs, memory, disk, network, ports, systemd, cron, users, environment, Docker
  • Fluent collections — chain filters, then .summarize(), .display(), or .all()
  • Workflow engine — JSON workflows (schema_version: 2), catalog templates, dry-run support
  • SSH remote — broad parity with local metrics and workflow execution on remote hosts
  • REPLserverkit CLI with completions, fluent chains, and connect / disconnect
  • AI assistant — intent routing, diagnostics, and workflow generation via Ollama

Documentation

Guide Description
User guide Mental model, SDK, REPL, remote, AI, troubleshooting
Examples Runnable sample scripts

Development

From a clone:

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest

Integration tests (live OS): pytest -m integration


License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

serverkit-0.3.5.tar.gz (92.2 kB view details)

Uploaded Source

Built Distribution

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

serverkit-0.3.5-py3-none-any.whl (108.6 kB view details)

Uploaded Python 3

File details

Details for the file serverkit-0.3.5.tar.gz.

File metadata

  • Download URL: serverkit-0.3.5.tar.gz
  • Upload date:
  • Size: 92.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for serverkit-0.3.5.tar.gz
Algorithm Hash digest
SHA256 8f88d186057b6dbb72eda1058e38309274829f1bb6df3d28a928a2caf034989e
MD5 ff996fba0ee76ed271cb0272c95e7525
BLAKE2b-256 38a9852be09c103f37ce7d927b9ad7e7063150fe6025f9d04ed5d6f5f49c1fbf

See more details on using hashes here.

File details

Details for the file serverkit-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: serverkit-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 108.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for serverkit-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c3a0a5fdaffafbdd7d27764a9cf9046b28eb965f0cec8b4612ed9e3a8c4c9283
MD5 92c2cf987cd966a15680e73a4adf288e
BLAKE2b-256 d4fadf82318a3a00816a94801b00e92710891061513f0d094ee5a4f44daef301

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