Skip to main content

TreeFuse creates a FUSE filesystem from a treelib.Tree

Project description

TreeFuse

https://img.shields.io/pypi/v/treefuse.svg Travis (.com) Documentation Status

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.

History

1.1.2 (2021-07-30)

  • Fix up one missed 3.6 reference.

1.1.1 (2021-07-30)

  • Make drop of support for Python 3.6 official.

1.1.0 (2021-07-30)

  • Substantial refactor to introduce the internal infrastructure for non-treelib TreeFuseProvider classes.

1.0.0 (2021-07-28)

  • Add documentation.

  • Implement support for providing non-default stat values for nodes (via treefuse.TreeFuseStat).

  • Replace temporary ENOENT error returns with more appropriate codes.

  • Fix default usage string.

0.1.0 (2021-07-27)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

treefuse-1.1.2.tar.gz (23.5 kB view hashes)

Uploaded source

Built Distribution

treefuse-1.1.2-py2.py3-none-any.whl (8.9 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page