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.2 · 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 lives at ~/.serverkit/config.json (output theme, Ollama model, SSH defaults, workflow settings).


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
REPL verification Copy-paste checks for local and remote sessions
AI testing Ollama setup, automated tests, model tips
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.2.tar.gz (87.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.2-py3-none-any.whl (103.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: serverkit-0.3.2.tar.gz
  • Upload date:
  • Size: 87.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.2.tar.gz
Algorithm Hash digest
SHA256 6010d1428f6a322b776d13414628fc2b538f045fc3a374e237a9ca18ce610f96
MD5 87af49fe517cc6aaeb7301fc2ee63fe7
BLAKE2b-256 74d72759af6e6aa50a3088627a191981b91658a7d36e1fad44987bf43480bcf9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: serverkit-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 103.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 00bcf74cd3750e2957fd5b2bb1cf2880d137204e86f1639f7ee64f00a08b8924
MD5 dd50c3d979863970f2b2d0b5204b00d9
BLAKE2b-256 40a0334f589d1d63149a00846d757541e4edcd3bd1e7125def559ef003b88643

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