Python Virtual FS module

PyVFS introduction

PyVFS by itself is an abstraction layer that allows to build FS-like storages. The storage then can be exported with one of supported protocols. The storage is completely agnostic of the underlying protocol and a developer can choose the one that fits better in the requirements.

Two protocols are supported now, fuse and 9p. Fuse exports FS only to the local running system, has a reasonable performance. The 9p protocol can be used to export the storage with several transports: TCP/IP or UNIX socket. Right now PyVFS does not support client authorization on 9p sockets.

ObjectFS

Objectfs – pyvfs.objectfs module – is a library built on top of PyVFS. Objectfs implements a storage and a decorator, that can be used to export there any Python object or function.

It means, that you will get in the runtime a filesystem, with which you can access your live objects.

The library is not specific for any particular project, and can be used in any script. The integration is as simple as it is possible. All you need is to import the library and decorate functions and/or objects you want to export:

# just import the module and the decorator
from pyvfs.objectfs import export

...

# then decorate objects you want to browse
@export
class MyObject(object):
    ...

# or functions
@export
def MyFunction(arg1, arg2="default value", ...):
    ...

By default, the library uses weak references to objects, that allows the Python garbage collector to work properly. All objects, that are not referenced anymore (except from the FS) will disappear from the FS as well.

ObjectFS topics:

How to set up the FS export and mount it, read PyVFS protocols setup

Indices and tables