The Workspace class manages static and dynamic file serving with support for multiple search paths (overlay), similar to how $PATH works for executables.
Overview
When assets are spread across multiple directories, Workspace provides a unified interface to serve them all:
python
from vuer import Vuervuer = Vuer(workspace=["./assets", "/data/robots", "./fallback"])
API Summary
Method
Description
vuer.workspace.link(target, "/path")
Link file or callable to URL
vuer.workspace.unlink("/path")
Remove a link
vuer.workspace.find("file.txt")
Find file in overlay
vuer.workspace.mount("./dir", to="/route")
Mount single directory
vuer.workspace.paths
Access paths (read-only tuple)
Usage Examples
Basic Usage
python
from vuer import Vuer# Single path (simplest)vuer = Vuer(workspace="./assets")# Multiple paths - searched in order, first match winsvuer = Vuer(workspace=["./local", "/shared/assets", "/data"])
Overlay Behavior
The overlay works like $PATH - paths are searched in order:
python
vuer = Vuer(workspace=["./local", "/shared", "/data"])# Request for /workspace/robot.urdf searches:# 1. ./local/robot.urdf# 2. /shared/robot.urdf# 3. /data/robot.urdf# Returns first match found# Find a file programmaticallypath = vuer.workspace.find("models/robot.urdf")if path: print(f"Found at: {path}")
Dynamic Links
Links can be added and removed at runtime. The link() method accepts either a file path or a callable: