fabricatio_sandbox.rust
Classes
High-level sandbox: in-memory upper layer + optional read-only real-dir mounts. |
|
Thin wrapper around [VfsPath] exposing filesystem operations to Python. |
Package Contents
- class fabricatio_sandbox.rust.SandboxSession
High-level sandbox: in-memory upper layer + optional read-only real-dir mounts.
Tracks original file content on first mutation so diff() produces per-file unified diffs and apply() can flush changes to the real FS.
- static with_mounts(mounts: Mapping[str, str]) SandboxSession
Create a sandbox session with read-only real-directory mounts.
mountsmaps virtual paths (e.g."/project") to real directories. All writes go to the in-memory upper layer; reads fall through to the mounted real directories.
- write_text(path: str, content: str) None
Write text to a file, snapshotting the original before first mutation.
- write_bytes(path: str, content: Sequence[int]) None
Write raw bytes to a file, snapshotting the original before first mutation.
- apply() None
Flush mutations from the in-memory layer back to the real filesystem using the mount mappings.
Only files that were written through the session are flushed. New files are created under the matching mount’s real directory; existing files are overwritten.
- reset() None
Clear tracked originals and written paths so the next
diff()captures only fresh changes.
- class fabricatio_sandbox.rust.VirtualFS
Thin wrapper around [VfsPath] exposing filesystem operations to Python.
- static from_overlay(real_roots: Sequence[str]) VirtualFS
Layer an in-memory upper layer over read-only real directories.
Writes go to the in-memory layer; reads fall through to the real dirs.
- write_text(path: str, content: str) None
Write text content to a file, creating parent directories as needed.