py_fs_shell
Python virtual filesystem primitives for agent workflows, tests, and sandboxed file operations.
It provides:
InMemoryFsfor ephemeral virtual filesystemsLocalFileSystemfor sandboxed real-disk accessWorkspacefor metadata + blob backed storageFileSystemStateBackendfor JSON, search/replace, diffs, archives, hashing, and edit planning
Installation
With uv:
uv add py-fs-shell
With pip:
pip install py-fs-shell
For S3-backed workspaces:
uv add 'py-fs-shell[s3]'
pip install 'py-fs-shell[s3]'
For local development from this repository:
uv sync --extra dev --extra s3
Examples
In-memory workspace:
import asyncio
from py_fs_shell import StateWriteEditInstruction, workspace
async def main():
ws = await workspace.memory()
state = ws.state()
await state.write_file("/src/main.py", "print('hello world')\n")
await state.write_json("/config.json", {"debug": True})
matches = await state.search_files("**/*.py", "hello")
print(matches[0].path)
plan = await state.plan_edits([
StateWriteEditInstruction(
path="/README.md",
content="# Demo\n",
),
])
await state.apply_edit_plan(plan)
await state.write_file_bytes("/video.mp4", b"video bytes")
asyncio.run(main())
Local workspace:
import asyncio
from pathlib import Path
from py_fs_shell import workspace
async def main():
ws = await workspace.local(Path(".py_fs_shell_workspace"))
state = ws.state()
await state.write_file("/notes/todo.md", "- ship release\n")
await state.write_json("/metadata.json", {"backend": "local"})
print(await state.read_file("/notes/todo.md"))
asyncio.run(main())
To reclaim orphaned blobs left behind by older workspace versions, run:
result = await ws.garbage_collect_blobs()
print(result.deleted, result.deleted_keys)
Current versions also clean up unreferenced blobs automatically on file overwrite/delete.
S3-backed workspace:
import asyncio
from py_fs_shell import workspace
async def main():
ws = await workspace.s3(bucket="my-bucket", prefix="runs/123")
state = ws.state()
await state.write_file("/outputs/result.txt", "done\n")
await state.write_json("/metadata.json", {"backend": "s3"})
print(await state.read_file("/outputs/result.txt"))
asyncio.run(main())
Releases
Releases are tracked with semversioner. See RELEASE.md and CHANGELOG.md.
License
MIT. See LICENSE.
Inspired by Cloudflare's @cloudflare/shell package.
Metadata
Release files for py-fs-shell 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_fs_shell-0.0.3.tar.gz | 80.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_fs_shell-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 114.5 kB
Release files / py_fs_shell-0.0.3.tar.gz
| Download URL | py_fs_shell-0.0.3.tar.gz |
|---|---|
| Size | 80.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3255dec57c618fbd11c9fa79a4b87d3b40d6a50382c4d44c7b8af22d1f6563eb
|
|
BLAKE2b-256 checksum How to use checksums |
56e35776c80a5859f1756c7a1da7b951227df94c5749f55700a051493549358f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 17, 2026.
Transparency logRelease files / py_fs_shell-0.0.3-py3-none-any.whl
| Download URL | py_fs_shell-0.0.3-py3-none-any.whl |
|---|---|
| Size | 34.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01c396e3fca968cbaa44fd2b5009446cfd6de6aec12540ce77c19d946d120ab1
|
|
BLAKE2b-256 checksum How to use checksums |
a97ccb6573443b52b586fa32ab7163c8925d6996857a9ae5964ee805f3099bab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 17, 2026.
Transparency log