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.6 · 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.6.tar.gz (90.1 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.6-py3-none-any.whl (106.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: serverkit-0.3.6.tar.gz
  • Upload date:
  • Size: 90.1 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.6.tar.gz
Algorithm Hash digest
SHA256 de67c277be305ed75664f07cf78bd2ea77254d5aaf7741d470344608f1dcdade
MD5 43fd3ed662547d8249371a3d948ce717
BLAKE2b-256 63e9e5301bb61b2023c27110d300c79bcc547cb4fb221c705a00be036a530a35

See more details on using hashes here.

File details

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

File metadata

  • Download URL: serverkit-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 106.5 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b98f2e50c76e9aa7ab861397fee52819c6b449574646a11424d42dab5da17ec4
MD5 3c996186ffd009a1c9cadabecc427584
BLAKE2b-256 914448853c4fe1a19aa06715dbcb99d7cf79953d2ee6bfed9740c86697e9a4c0

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