Skip to content

A lightweight command-line tool built in pure Python to display system information — CPU, RAM, disk, network, and uptime — with text and JSON output modes.

Notifications You must be signed in to change notification settings

mircothibes/sysinfo-cli

Repository files navigation

🖥️ sysinfo-cli CI

Python Docker Lint Format Tests

A simple command-line tool written in pure Python that displays system information such as CPU, RAM, disk, network, and uptime.
It supports both standard text and JSON output.


🚀 Quick Start (Local)

# Clone this repository
git clone https://github.com/mircothibes/sysinfo-cli.git
cd sysinfo-cli

# Create and activate the virtual environment
python -m venv .venv && source .venv/bin/activate

# Install dependencies (development tools included)
pip install -e ".[dev]"

# Run the CLI
python -m sysinfo.cli
python -m sysinfo.cli --json

Example output:

CPU: cores=16 load={'1m': 0.18, '5m': 0.11, '15m': 0.03}
RAM: used=640000kB/8036544kB (7.9%)
DISK: used=3458965504/1081101176832 (0.32%)
NET: total_rx=290 total_tx=42
UPTIME: 21000s

🐳 Docker

You can run the same CLI in a lightweight Docker container.

# Build the image
docker build -t mvtk/sysinfo-cli:0.1.0 .

# Run it (JSON output)
docker run --rm mvtk/sysinfo-cli:0.1.0 --json

# Or plain text output
docker run --rm mvtk/sysinfo-cli:0.1.0

Example JSON output:

{
  "cpu": {"cores": 16, "loadavg": {"1m": 0.18, "5m": 0.11, "15m": 0.03}},
  "ram": {"total_kb": 8036544, "available_kb": 7397756, "used_kb": 638788, "percent": 7.95},
  "disk": {"path": "/", "total_bytes": 1081101176832, "used_bytes": 3458957312, "free_bytes": 1022649864192, "percent": 0.32},
  "net": {"total": {"rx_bytes": 290, "tx_bytes": 42}},
  "uptime": {"seconds": 20201}
}

🧰 Development

I use Neovim as my main development environment with:

  • lazy.nvim
  • mason.nvim
  • nvim-lspconfig -> (Pyright)
  • conform.nvim -> for formatting

Useful Commands:

ruff check .
black .
pytest -q

🧪 Tests

Run all tests using pytest:

pytest -q

📦 Project Structure

sysinfo-cli/
├── src/
│   └── sysinfo/
│       ├── __init__.py
│       └── cli.py
├── tests/
│   └── test_cli.py
├── pyproject.toml
├── Dockerfile
├── .dockerignore
├── .gitignore
└── README.md

⚙️C ommand Reference

Command Description
--json Output data in JSON format
--version Display CLI version
--help Show help message

🧾 License

This project is released under the MIT License.


👨‍💻 Author

Marcos Vinicius Thibes Kemer


About

A lightweight command-line tool built in pure Python to display system information — CPU, RAM, disk, network, and uptime — with text and JSON output modes.

Resources

Stars

Watchers

Forks

Packages

No packages published