refactor(bottles): make docker a package; absorb top-level docker.py
test / run tests/run_tests.py (pull_request) Successful in 14s
test / run tests/run_tests.py (pull_request) Successful in 14s
- claude_bottle/bottles/docker.py -> claude_bottle/bottles/docker/__init__.py - claude_bottle/docker.py -> claude_bottle/bottles/docker/util.py The host-side Docker primitives (require_docker, slugify, image_exists, container_exists, build_image, build_image_with_cwd) lived at the top of the package as if cross-cutting, but they are Docker-specific. Moving them into bottles/docker/util.py colocates them with the platform that uses them and clears the top-level namespace. Imports in bottles/docker/__init__.py shift to `from . import util as docker_mod` so the existing call sites (`docker_mod.require_docker()`, etc.) keep working unchanged.
This commit is contained in:
@@ -27,18 +27,18 @@ from dataclasses import dataclass
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Iterator
|
from typing import Iterator
|
||||||
|
|
||||||
from .. import docker as docker_mod
|
from ... import network as network_mod
|
||||||
from .. import network as network_mod
|
from ... import pipelock
|
||||||
from .. import pipelock
|
from ... import skills as skills_mod
|
||||||
from .. import skills as skills_mod
|
from ... import ssh as ssh_mod
|
||||||
from .. import ssh as ssh_mod
|
from ...env_resolve import env_resolve
|
||||||
from ..env_resolve import env_resolve
|
from ...log import die, info
|
||||||
from ..log import die, info
|
from .. import BottleCleanupPlan, BottlePlan, BottlePlatform, BottleSpec
|
||||||
from . import BottleCleanupPlan, BottlePlan, BottlePlatform, BottleSpec
|
from . import util as docker_mod
|
||||||
|
|
||||||
|
|
||||||
# Where the repo root lives, for `docker build` context. Computed once.
|
# Where the repo root lives, for `docker build` context. Computed once.
|
||||||
_REPO_DIR = str(Path(__file__).resolve().parent.parent.parent)
|
_REPO_DIR = str(Path(__file__).resolve().parent.parent.parent.parent)
|
||||||
|
|
||||||
|
|
||||||
# --- Runtime detection -----------------------------------------------------
|
# --- Runtime detection -----------------------------------------------------
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
"""Docker helpers. Build/inspect primitives shared by the CLI."""
|
"""Docker host-side primitives used by DockerBottlePlatform: probing
|
||||||
|
for docker on PATH, slugifying agent names, checking image/container
|
||||||
|
existence, and building images."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
@@ -7,7 +9,7 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
||||||
from .log import die, info
|
from ...log import die, info
|
||||||
|
|
||||||
|
|
||||||
def require_docker() -> None:
|
def require_docker() -> None:
|
||||||
Reference in New Issue
Block a user