refactor(bottles): Bottle becomes an ABC; DockerBottle inherits
test / run tests/run_tests.py (pull_request) Successful in 14s
test / run tests/run_tests.py (pull_request) Successful in 14s
Bottle was the only Protocol in an otherwise-ABC family (BottlePlan, BottleCleanupPlan, BottlePlatform are all ABCs). Convert to an ABC with abstract exec_claude / cp_in / close, matching the rest of the hierarchy. Rename _DockerBottle -> DockerBottle: the underscore was a default-Python-private instinct that doesn't match the sibling plan classes (DockerBottlePlan, DockerBottleCleanupPlan), all of which are equally "only constructed by the platform" and yet public-by-name. Re-export DockerBottle from claude_bottle.bottles.docker.
This commit is contained in:
@@ -31,7 +31,6 @@ from abc import ABC, abstractmethod
|
||||
from contextlib import AbstractContextManager
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Protocol
|
||||
|
||||
from ..log import die
|
||||
from ..manifest import Manifest
|
||||
@@ -82,7 +81,7 @@ class BottleCleanupPlan(ABC):
|
||||
short-circuit before showing the y/N."""
|
||||
|
||||
|
||||
class Bottle(Protocol):
|
||||
class Bottle(ABC):
|
||||
"""Handle to a running bottle. Yielded by a platform's launch step.
|
||||
|
||||
`exec_claude` runs `claude` inside the bottle and blocks until the
|
||||
@@ -92,8 +91,13 @@ class Bottle(Protocol):
|
||||
|
||||
name: str
|
||||
|
||||
@abstractmethod
|
||||
def exec_claude(self, argv: list[str], *, tty: bool = True) -> int: ...
|
||||
|
||||
@abstractmethod
|
||||
def cp_in(self, host_path: str, container_path: str) -> None: ...
|
||||
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user