Skip to content

feat(workspaces): mount volumes and name the container of a DockerWorkspace - #118

Merged
DEENUU1 merged 1 commit into
mainfrom
feat/docker-workspace-volumes-and-name
Oct 5, 2026
Merged

DEENUU1 merged 1 commit into
mainfrom
feat/docker-workspace-volumes-and-name

Conversation

@DEENUU1

@DEENUU1 DEENUU1 commented Oct 5, 2026

Copy link
Copy Markdown
Member

Problem

pydantic-deep's CLI runs in Docker with the project mounted at /workspace and, for a named workspace, the same container every time it starts. Moving it onto Pydantic AI workspaces (the follow-up to #112) needs both from DockerWorkspace, which exposed neither. They were reachable only by building DockerWorkspaceBackend with a sandbox factory of your own.

Separately, the package shipped no py.typed, so type checkers in projects that install it read every name as Any. pydantic-deep's mypy run surfaced it.

Change

  • DockerWorkspace(volumes={host: container}) passes the mounts to DockerSandbox.
  • DockerWorkspace(container_name=...) / DockerWorkspaceBackend(container_name=...): one container named by whoever configures the workspace. It is created on first use and attached after, by this process or the next. A ref naming it must still find it there (WorkspaceUnavailableError otherwise), and a ref naming any other container is declined by the capability and refused by the backend. destroy accepts it.
  • src/pydantic_ai_backends/py.typed.

Verification

  • 1320 tests at 100% coverage; ruff, pyright and mypy are clean.
  • New unit tests cover: creation under the configured name, attaching while the container exists, an unavailable ref once it is gone, a foreign ref refused and declined, destroy, and volumes reaching the sandbox.
  • On a real Docker daemon: a host file is readable inside the container, a file written inside appears on the host, and a second backend reaches the same container by name.
  • The built wheel contains pydantic_ai_backends/py.typed.

…kspace

A tool run from a project directory - pydantic-deep's CLI in Docker mode -
wants its project mounted in the container and the same container every
time it starts, and has no message history to carry a ref in. Both were
reachable only by building DockerWorkspaceBackend with a sandbox factory.

volumes mounts host directories. container_name names one container for
every run: created on first use, attached after. A ref naming it must
still find it there, and no ref reaches another container through it.

Also ships py.typed, without which type checkers in projects installing
this package read every name as Any.

Verified: 1320 tests at 100% coverage; ruff, pyright, mypy. On a real
daemon a mounted host file reads inside, a file written inside appears on
the host, and a second backend reaches the same container by name.
@DEENUU1
DEENUU1 merged commit 351b1ad into main Oct 5, 2026
15 checks passed
@DEENUU1
DEENUU1 deleted the feat/docker-workspace-volumes-and-name branch October 5, 2026 19:13
@DEENUU1 DEENUU1 mentioned this pull request Oct 5, 2026
DEENUU1 added a commit that referenced this pull request Oct 5, 2026
Cuts 0.2.31 for #118: `DockerWorkspace` mounts volumes and can name one
container for every run, and the package ships `py.typed`.

Release-only: `pyproject.toml` version + `CHANGELOG.md`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant