Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/sugar/docker_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from docker import from_env

client = from_env()


def get_containers():
return client.containers.list(all=True)


def get_images():
return client.images.list()


def get_volumes():
return client.volumes.list()
Comment on lines +1 to +15

Copilot AI Feb 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module creates a Docker client at the module level (line 3), but it is never used anywhere in the codebase. The functions defined here (get_containers, get_images, get_volumes) are also unused. Meanwhile, the TUI code creates its own Docker clients in multiple places (app.py line 56, logs.py line 34). This creates unnecessary code duplication and potential resource leaks.

Consider either:

  1. Removing this unused module entirely, or
  2. Refactoring the TUI code to use a shared Docker client instance from this module to avoid creating multiple clients
Suggested change
from docker import from_env
client = from_env()
def get_containers():
return client.containers.list(all=True)
def get_images():
return client.images.list()
def get_volumes():
return client.volumes.list()
"""
Deprecated placeholder module for Docker client utilities.
This module previously created a Docker client at import time and exposed
helper functions to list containers, images, and volumes. It is currently
unused by the rest of the codebase, and the eager client creation caused
unnecessary resource initialization.
The implementation has been removed to avoid side effects and dead code.
If a shared Docker client is needed in the future, it can be implemented
here with lazy initialization and explicitly used by the TUI code.
"""

Copilot uses AI. Check for mistakes.
Loading
Loading