!!! note “Version 0.1.0 - Foundation Release” Currently implements embedded mode only. Monolithic and distributed modes are planned for future releases.
Nexus is an AI-native distributed filesystem designed for AI agent infrastructure. v0.1.0 is the foundation release providing core embedded filesystem functionality with SQLite-backed metadata storage.
read()
, write()
, delete()
, exists()
, list()
!!! warning “Planned Features” Everything else in the vision is planned but not implemented:
git clone https://github.com/nexi-lab/nexus.git
cd nexus
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"
import nexus
# Connect to embedded filesystem
nx = nexus.connect()
# Write a file
nx.write("/workspace/hello.txt", b"Hello World")
# Read it back
content = nx.read("/workspace/hello.txt")
print(content) # b'Hello World'
# Check existence
if nx.exists("/workspace/hello.txt"):
print("File exists!")
# List files
files = nx.list("/workspace/")
print(files) # ['/workspace/hello.txt']
# Delete
nx.delete("/workspace/hello.txt")
# Clean up
nx.close()
import nexus
with nexus.connect() as nx:
nx.write("/data/test.txt", b"Test content")
content = nx.read("/data/test.txt")
# Automatically closed
Create nexus.yaml
:
mode: embedded
data_dir: ./nexus-data
Or use environment variables:
export NEXUS_MODE=embedded
export NEXUS_DATA_DIR=./nexus-data
Or configure programmatically:
import nexus
nx = nexus.connect({
"mode": "embedded",
"data_dir": "./my-data"
})
┌─────────────────────┐
│ Your Application │
│ │
│ ┌──────────────┐ │
│ │ Nexus │ │
│ │ Embedded │ │
│ └──────┬───────┘ │
│ │ │
│ ┌────┴────┐ │
│ │ SQLite │ │ (metadata)
│ └─────────┘ │
│ │ │
│ ┌────┴────┐ │
│ │Local FS │ │ (file content)
│ └─────────┘ │
└─────────────────────┘
nexus.connect(config=None)
Connect to Nexus filesystem.
Arguments:
config
- Config dict, file path, or None (auto-discover)Returns: Embedded
instance
Embedded
Classread(path: str) -> bytes
Read file content.
Raises: NexusFileNotFoundError
if file doesn’t exist
write(path: str, content: bytes) -> None
Write file content. Creates parent directories automatically.
delete(path: str) -> None
Delete a file.
Raises: NexusFileNotFoundError
if file doesn’t exist
exists(path: str) -> bool
Check if file exists.
list(prefix: str = "") -> list[str]
List files with given path prefix.
close() -> None
Close the filesystem and release resources.
NexusError
- Base exceptionNexusFileNotFoundError
- File not foundNexusPermissionError
- Permission deniedInvalidPathError
- Invalid path (e.g., contains ..
)BackendError
- Storage backend errorMetadataError
- Metadata store error# Run tests
pytest
# Type checking
mypy src/nexus
# Linting
ruff check .
# Formatting
ruff format .
See Development Guide for contribution guidelines.
Apache 2.0 - see LICENSE