Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
888b9be
chore: scaffold uv project structure
miciav Apr 5, 2026
43d4752
feat: add typed exception hierarchy
miciav Apr 5, 2026
94b71a9
feat: add CommandBackend protocol, SubprocessBackend, FakeBackend
miciav Apr 5, 2026
62fbd3d
feat: add typed data models with JSON parsers
miciav Apr 5, 2026
cad1af5
feat: add MultipassVM with full method coverage
miciav Apr 5, 2026
3e573b4
feat: add MultipassClient with full command coverage and public API e…
miciav Apr 5, 2026
d5bc9e2
chore: add integration tests, remove legacy files, update CI to use uv
miciav Apr 5, 2026
d40a883
refactor: simplify backend, vm, client — extract _run helpers, remove…
miciav Apr 5, 2026
0bd15dc
test: add missing tests for restart, suspend, recover, alias
miciav Apr 5, 2026
1e745cb
feat: add wait_for_ip and wait_ready for reliable SSH connectivity
miciav Apr 5, 2026
199e84b
Fix snapshot JSON format and add missing integration test scenarios
miciav Apr 5, 2026
62b538c
Update README with complete API reference and installation guide
miciav Apr 5, 2026
c657a94
feat: add cloud_init_config param and snap-safe temp file handling
miciav Apr 6, 2026
2ebbcaa
feat: add find_ssh_public_key() utility to utils module
miciav Apr 7, 2026
bf580e5
feat: add MultipassClient.ensure_running() idempotent VM lifecycle me…
miciav Apr 7, 2026
cebdc57
refactor: move VmNotFoundError import to module level in client.py
miciav Apr 7, 2026
b6adfdf
chore: bump to v0.4.0, document ensure_running and find_ssh_public_key
miciav Apr 7, 2026
e603372
docs: warn about system-wide purge in ensure_running docstring
miciav Apr 7, 2026
699d360
fix: serialize cloud_init_config dict as YAML with #cloud-config header
miciav Apr 8, 2026
83b3704
feat: add MultipassVM.exec_structured() to confine bash boundary in SDK
miciav Apr 12, 2026
54f2ac8
feat: add VmConfig, launch_many, CloudInitConfig, e2e, and align with…
miciav May 18, 2026
308a4d7
feat: extend e2e with feature tests for all major VM operations
miciav May 18, 2026
f953a86
docs: update README with VmConfig, CloudInitConfig, launch_many, exec…
miciav May 18, 2026
402c406
fix: never inherit caller stdin in SubprocessBackend (multipass exec …
miciav Jun 11, 2026
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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
branches: [ main ]

jobs:
test_pull_request:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
python-version: 3.8
version: "latest"
- name: Install dependencies
run: python -m pip install -r requirements.txt
- name: Check if multipass.py works
run: python multipass.py
run: uv sync --extra dev
- name: Run unit tests
run: uv run pytest tests/unit/ -v --tb=short
40 changes: 40 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Overview

An unofficial Python SDK that wraps the Multipass CLI to manage Ubuntu VMs programmatically. Full coverage of every Multipass CLI command. Designed to be imported by other projects (e.g. nanofaas) — it has no dependencies on them.

## Setup

```bash
uv sync --extra dev
```

Requires [uv](https://docs.astral.sh/uv/). Multipass itself is NOT required for unit tests.

## Running Tests

```bash
# Unit tests only (no Multipass required)
uv run pytest tests/unit/ -v

# Single test
uv run pytest tests/unit/test_vm.py::test_exec_builds_command_from_list -v

# Integration tests (requires Multipass installed)
uv run pytest -m integration -v
```

## Architecture

`src/multipass/` contains five modules:

- `_backend.py` — `CommandResult` dataclass, `CommandBackend` protocol, `SubprocessBackend` (real CLI), `FakeBackend` (for tests). All subprocess calls go through the backend.
- `exceptions.py` — Typed exception hierarchy rooted at `MultipassError`.
- `models.py` — Dataclasses (`VmInfo`, `VmState`, `ImageInfo`, etc.) with `from_*_json()` class methods that parse the actual Multipass CLI JSON output.
- `vm.py` — `MultipassVM`: per-VM operations (info, start, stop, restart, suspend, delete, recover, exec, transfer, mount, unmount, snapshot, restore, clone).
- `client.py` — `MultipassClient`: global operations (launch, list, find, purge, networks, version, get, set, aliases).

`MultipassClient` creates `MultipassVM` instances and passes its backend down to them. Unit tests inject a `FakeBackend` configured with pre-built `CommandResult` responses.
Loading