Skip to content

Fix #24: Integrate python-on-whales for Docker operations#88

Open
ClaydeCode wants to merge 1 commit into
mainfrom
clayde/issue-24
Open

Fix #24: Integrate python-on-whales for Docker operations#88
ClaydeCode wants to merge 1 commit into
mainfrom
clayde/issue-24

Conversation

@ClaydeCode
Copy link
Copy Markdown
Contributor

Summary

  • Replaces the docker SDK and raw subprocess calls for Docker/Compose operations with python-on-whales, which provides a typed Python API for both the Docker daemon and Docker Compose
  • Wraps the synchronous python-on-whales calls in asyncio.to_thread() wherever they appear in async functions
  • Updates exception handling from docker.errors.NotFound / SubprocessError to python_on_whales.exceptions.NoSuchContainer / DockerException

Closes #24

Recommended reading order

  1. pyproject.toml / uv.lock — dependency swap: dockerpython-on-whales
  2. shard_core/service/app_tools.py — docker-compose up/stop/down and image prune
  3. shard_core/service/app_installation/__init__.py — docker registry login
  4. shard_core/web/internal/app_error.py — container status lookup
  5. shard_core/web/internal/call_peer.py — container/network lookup by IP
  6. tests/util.py — docker network create/disconnect/remove helpers
  7. tests/test_app_installation.py / tests/test_app_lifecycle.py — test assertions using container inspect

🤖 Generated with Claude Code

Replaces the `docker` SDK and raw subprocess calls for Docker/Compose
operations with `python-on-whales`, which provides a typed Python API
for both Docker and Docker Compose.

Key changes:
- docker-compose up/stop/down → DockerClient(compose_project_directory=…).compose.*
- docker image prune → DockerClient().image.prune()
- docker login → DockerClient().login()
- docker.from_env() container/network queries → DockerClient().container/network.*
- Synchronous python-on-whales calls wrapped in asyncio.to_thread() in async contexts
- docker.errors.NotFound → python_on_whales.exceptions.NoSuchContainer
- SubprocessError → python_on_whales.exceptions.DockerException

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate Pyhton on Whales or some other docker python lib

1 participant