bcbd1bdb22
Integ / changes (push) Has been skipped
Pre-commit / pre-commit (push) Failing after 1s
CLI exit codes / changes (push) Has been skipped
Test (Install) / changes (push) Has been skipped
Test (Python) / changes (push) Has been skipped
Test (TypeScript) / changes (push) Has been skipped
CLI exit codes / cli-gate (push) Has been cancelled
Test (Install) / test-install-gate (push) Has been cancelled
Integ / integ-gate (push) Has been cancelled
Test (Python) / test-python-gate (push) Has been cancelled
Test (TypeScript) / test-typescript-gate (push) Has been cancelled
Test (Install) / python-minimal (3.12) (push) Has been cancelled
Test (Install) / python-minimal (3.11) (push) Has been cancelled
Test (Install) / python-extra (agno, mirage.agents.agno) (push) Has been cancelled
Test (Install) / python-extra (chroma, mirage.resource.chroma) (push) Has been cancelled
Test (Install) / python-extra (pdf, mirage.core.filetype.pdf) (push) Has been cancelled
Integ / integ (push) Has been cancelled
Integ / integ-database (push) Has been cancelled
Integ / integ-database-ts (push) Has been cancelled
Integ / integ-data (push) Has been cancelled
Integ / integ-ssh (push) Has been cancelled
Integ / integ-ssh-ts (push) Has been cancelled
Test (Python) / audit (push) Has been cancelled
Test (TypeScript) / test (push) Has been cancelled
Test (TypeScript) / python-fs-shim (push) Has been cancelled
CLI exit codes / Python CLI (push) Has been cancelled
CLI exit codes / TypeScript CLI (push) Has been cancelled
CLI exit codes / Cross-language snapshot interop (push) Has been cancelled
Test (Python) / test (push) Has been cancelled
Test (Python) / import-isolation (deepagents, openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Python) / import-isolation (deepagents, pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Integ / integ-ts (push) Has been cancelled
Integ / integ-fuse (push) Has been cancelled
Test (Install) / python-extra (databricks, mirage.resource.databricks_volume) (push) Has been cancelled
Test (Install) / python-extra (deepagents, mirage.agents.langchain) (push) Has been cancelled
Test (Install) / python-extra (email, mirage.resource.email) (push) Has been cancelled
Test (Install) / python-extra (fuse, mirage.fuse.mount) (push) Has been cancelled
Test (Install) / python-extra (hdf5, mirage.core.filetype.hdf5) (push) Has been cancelled
Test (Install) / python-extra (hf, mirage.resource.hf_buckets) (push) Has been cancelled
Test (Install) / python-extra (lancedb, mirage.resource.lancedb) (push) Has been cancelled
Test (Install) / python-extra (langfuse, mirage.resource.langfuse) (push) Has been cancelled
Test (Install) / python-extra (mongodb, mirage.resource.mongodb) (push) Has been cancelled
Test (Install) / python-extra (nextcloud, mirage.resource.nextcloud) (push) Has been cancelled
Test (Install) / python-extra (openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Install) / python-extra (openhands, mirage.agents.openhands, 3.12) (push) Has been cancelled
Test (Install) / python-extra (parquet, mirage.core.filetype.parquet) (push) Has been cancelled
Test (Install) / python-extra (postgres, mirage.resource.postgres) (push) Has been cancelled
Test (Install) / python-extra (pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Test (Install) / python-extra (qdrant, mirage.resource.qdrant) (push) Has been cancelled
Test (Install) / python-extra (redis, mirage.resource.redis) (push) Has been cancelled
Test (Install) / python-extra (s3, mirage.resource.s3) (push) Has been cancelled
Test (Install) / python-extra (ssh, mirage.resource.ssh) (push) Has been cancelled
Test (Install) / ts-minimal (push) Has been cancelled
102 lines
3.2 KiB
Plaintext
102 lines
3.2 KiB
Plaintext
---
|
|
title: FUSE
|
|
icon: hard-drive
|
|
description: Set up FUSE support for MIRAGE in Python.
|
|
---
|
|
|
|
## Prerequisites
|
|
|
|
- Python 3.11+
|
|
- [uv](https://docs.astral.sh/uv/) package manager (optional)
|
|
|
|
## System FUSE
|
|
|
|
Install the OS-level FUSE kernel extension first:
|
|
|
|
- [macOS FUSE Setup](/home/setup/macos), macFUSE + kernel extension + Apple Silicon recovery mode steps.
|
|
- [Linux FUSE Setup](/home/setup/linux), `fuse3` install and `/etc/fuse.conf`.
|
|
|
|
## Install Mirage with the FUSE Extra
|
|
|
|
```bash
|
|
pip install "mirage-ai[fuse]"
|
|
```
|
|
|
|
Or with uv:
|
|
|
|
```bash
|
|
uv add "mirage-ai[fuse]"
|
|
```
|
|
|
|
## Verify
|
|
|
|
```python
|
|
from mirage import Mount, MountMode, Workspace
|
|
from mirage.resource.ram import RAMResource
|
|
|
|
with Workspace(
|
|
{"/data": Mount(RAMResource(), mode=MountMode.WRITE, fuse=True)}) as ws:
|
|
print("mountpoints:", ws.fuse_mountpoints)
|
|
```
|
|
|
|
If the printed path exists under `/tmp/mirage-*`, FUSE is wired up correctly.
|
|
|
|
The `Workspace` constructor blocks until every `fuse` mount is live, so the
|
|
mountpoint is ready to read as soon as the `with` block is entered, no sleep
|
|
needed. (In TypeScript, where mounts are async, you `await ws.fuseReady()`
|
|
instead.)
|
|
|
|
## Per-mount FUSE
|
|
|
|
FUSE is configured **per mount**. Each mount whose `fuse` is set is exposed at
|
|
its own mountpoint, showing only that mount's subtree. The value is either
|
|
`true` (mount at a fresh temp directory) or a path string (mount there,
|
|
creating the directory if missing):
|
|
|
|
```yaml
|
|
mode: WRITE
|
|
mounts:
|
|
/data:
|
|
resource: ram
|
|
fuse: /tmp/data-repo # explicit path
|
|
/s3:
|
|
resource: s3
|
|
fuse: true # temp directory
|
|
/logs:
|
|
resource: disk
|
|
# no fuse key, not FUSE-exposed
|
|
```
|
|
|
|
`ws.fuse_mountpoints` returns a `{prefix: path}` map of the live mountpoints.
|
|
|
|
## Size semantics for API-backed files
|
|
|
|
Some resources (Linear, Trello, Slack, ...) cannot report a file's size
|
|
without fetching its content, so `stat` returns an unknown size. Over the
|
|
FUSE mount these files behave like Linux `/proc` files: they stat as **0
|
|
bytes until first open**, and become fully readable the moment anything opens
|
|
them. Mirage mounts with `direct_io` (the kernel reads to EOF regardless of
|
|
the reported size) and `attr_timeout=0` (post-open `fstat` returns the real
|
|
size of the now-fetched content, kept warm in a 30-second cache).
|
|
|
|
What that means per tool:
|
|
|
|
| Tools | Behavior |
|
|
| --- | --- |
|
|
| `cat`, `grep`, `head`, `cp`, `md5sum`, `sed`, `sort` | correct content, always |
|
|
| `wc -c`, `tail -c` | correct (they fstat after open, which serves the real size) |
|
|
| `ls -l`, `du`, `find -size`, `test -s` | report 0 until the file has been opened recently |
|
|
| `tar`, `rsync`, `scp` | see 0 at stat time and copy empty content, exactly like `tar` over `/proc`; read the file first or use `cat`/`cp` based flows |
|
|
|
|
Mirage never reports a fake size and never fetches content during `stat`:
|
|
returning real sizes eagerly would fire one API call per file on every
|
|
`ls -l`.
|
|
|
|
<Warning>
|
|
**macOS allows only one in-process FUSE mount.** macFUSE registers a
|
|
process-global signal source, so a second simultaneous mount in the same
|
|
process fails with `fuse: cannot register signal source`. Multiple per-mount
|
|
FUSE mounts work on Linux; on macOS, enable `fuse` on a single mount per
|
|
workspace (or run additional mounts in separate processes).
|
|
</Warning>
|