feat: Update README and add requirements.txt for rich library installation instructions

This commit is contained in:
Peter Wood
2025-12-09 12:49:20 -05:00
parent 817aed748c
commit e8ce1f192f
3 changed files with 62 additions and 54 deletions

View File

@@ -18,10 +18,11 @@ A Python command-line application to manage Docker containers defined in subdire
- Python 3 - Python 3
- Docker and Docker Compose (plugin) installed. - Docker and Docker Compose (plugin) installed.
- The `rich` Python library: - Python dependencies:
```bash ```bash
pip install rich pip install -r ~/shell/docker-manager/requirements.txt
``` ```
*Or manually:* `pip install rich`
- A `~/docker/` directory containing subdirectories for each of your projects. - A `~/docker/` directory containing subdirectories for each of your projects.
- Each project subdirectory must contain a `docker-compose.yml`, `docker-compose.yaml`, `compose.yml`, or `compose.yaml` file. - Each project subdirectory must contain a `docker-compose.yml`, `docker-compose.yaml`, `compose.yml`, or `compose.yaml` file.

View File

@@ -37,11 +37,17 @@ import argparse
import subprocess import subprocess
import json import json
from pathlib import Path from pathlib import Path
try:
from rich.console import Console from rich.console import Console
from rich.table import Table from rich.table import Table
from rich.panel import Panel from rich.panel import Panel
from rich.text import Text
from rich import box from rich import box
except ImportError:
print("Error: The 'rich' library is required but not installed.")
print("Please install it using: pip install -r ~/shell/docker-manager/requirements.txt")
print("Or directly: pip install rich")
exit(1)
# Configuration # Configuration
DOCKER_ROOT = Path(os.path.expanduser("~/docker")) DOCKER_ROOT = Path(os.path.expanduser("~/docker"))
@@ -261,14 +267,14 @@ def list_containers(projects):
update_status = "[dim]Not Monitored[/dim]" update_status = "[dim]Not Monitored[/dim]"
# If version is still unknown, try to get from running container labels # If version is still unknown, try to get from running container labels
if version == "latest" or version == "unknown": if version in ("latest", "unknown"):
inspect_cmd = ["docker", "inspect", c_name, "--format", "{{json .Config.Labels}}"] inspect_cmd = ["docker", "inspect", c_name, "--format", "{{json .Config.Labels}}"]
inspect_res = run_command(inspect_cmd, path, capture_output=True) inspect_res = run_command(inspect_cmd, path, capture_output=True)
if inspect_res and inspect_res.returncode == 0: if inspect_res and inspect_res.returncode == 0:
try: try:
labels = json.loads(inspect_res.stdout) labels = json.loads(inspect_res.stdout)
version = get_image_version(labels) version = get_image_version(labels)
except: except Exception:
pass pass
table.add_row(name, c_name, state, image, version, update_status) table.add_row(name, c_name, state, image, version, update_status)

View File

@@ -0,0 +1 @@
rich>=13.0.0