Welcome to TreeFuse’s documentation!

TreeFuse is a library for building FUSE filesystem CLIs from treelib Tree objects.

It wraps python-fuse to provide a CLI entrypoint (treefuse_main) which takes a tree parameter and uses that to construct a directory tree and generate file content within the FUSE filesystem.

Example Program

Executing this program:

import treelib
from treefuse import treefuse_main

tree = treelib.Tree()
root = tree.create_node("root")
dir1 = tree.create_node("dir1", parent=root)
tree.create_node("dirchild", parent=dir1, data=b"dirchild content\n")
tree.create_node("rootchild", parent=root, data=b"rootchild content\n")

treefuse_main(tree)

With a target directory (e.g. python3 example.py mnt) will mount a filesystem matching the given tree:

$ tree mnt
mnt
├── dir1
│   └── dirchild
└── rootchild

1 directory, 2 files

$ cat mnt/rootchild
rootchild content

$ cat mnt/dir1/dirchild
dirchild content

See Examples for more examples.

Roadmap

  • Abstract the interface so that sources other than treelib can be implemented

  • Provide a mechanism for library consumers to populate filesystem contents asynchronously

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

This library was written during a hack week at my employer, DigitalOcean.

Indices and tables