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.3 · 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.3.tar.gz (88.6 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.3-py3-none-any.whl (105.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: serverkit-0.3.3.tar.gz
  • Upload date:
  • Size: 88.6 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.3.tar.gz
Algorithm Hash digest
SHA256 6d41ea6a2332d2104faafad7d09db0051ff39cde76387471f3f751c05b6290f9
MD5 da8643a8677f4e5e13d18ffc6ddf595b
BLAKE2b-256 636539d8db55c033d6f7af6d1030c9c92b2b59d0bf8f458f5f7ae6dd45642ae0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: serverkit-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 105.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 98bd87c6c9a8fabf37135ae70d583587bf94aecd73932474708fdb0f120980f3
MD5 f37918b18d2a67857903a41a4d93ee5c
BLAKE2b-256 ea58129f228d79a5d882d8731d53c11c529406cde66605fa083829cff5e2f92b

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