{ "info": { "author": "Rapha\u00ebl Barrois", "author_email": "raphael.barrois+fslib@polytechnique.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Filesystems" ], "description": "fslib\n=====\n\nfslib is a wrapper around Python's ``os.*`` low-level functions, aiming to:\n\n* Provide more pythonic APIs for low-level primitives\n* Merge various physical locations into a simple pseudo-filesystem for the application\n* Handle UnionFS-like features, including transparent write overlay on top of read-only paths\n\nfslib supports Python 2.7 and 3.3+; it requires only the standard Python library.\n\nLinks\n-----\n\n* Documentation: (none yet)\n* Official repository: https://github.com/rbarrois/fslib/\n* Package: https://pypi.python.org/pypi/fslib/\n* Issues: https://github.com/rbarrois/fslib/issues/\n\n\nDownload\n--------\n\n\nPyPI: https://pypi.python.org/pypi/fslib/\n\n.. code-block:: sh\n\n $ pip install fslib\n\nSource: https://github.com/rbarrois/fslib/\n\n.. code-block:: sh\n\n $ git clone git://github.com/rbarrois/fslib/\n $ python setup.py install\n\n\nUsage\n-----\n\nReplacing ``import os``\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\n.. code-block:: pycon\n\n >>> import fslib\n >>>\n >>> fs = fslib.FileSystem(fslib.OSFS('/'))\n >>> fs.dir_exists('/etc/')\n True\n >>> fs.listdir('/')\n ['/etc', '/dev', '/proc']\n\n\nForcing read-only\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nIn order to ensure that user code doesn't change any physical file,\nfslib provides a simple wrapper that prevents writing to the filesystem.\n\n.. code-block:: pycon\n\n >>> import fslib\n >>> import fslib.stacking\n >>>\n >>> fs = fslib.FileSystem(fslib.stacking.ReadOnlyFS(fslib.OSFS('/')))\n >>> fs.read_one_line('/etc/hostname')\n \"ithor\"\n >>> fs.open('/tmp/x', 'w')\n OSError: [Errno 30] Read-only file system: '/tmp/x'\n\n\nUnionFS-like mounting\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nfslib provides a UnionFS-like wrapper as ``fslib.stacking.UnionFS``.\nThis backend will provide a merged view of several branch,\nredirecting all writes to the branch(es) declared ``writable=True``.\n\n.. code-block:: pycon\n\n >>> import fslib, fslib.builders, fslib.stacking\n >>>\n >>> mem_fs = fslib.builders.make_memory_fake()\n >>> union_fs = fslib.stacking.UnionFS()\n >>> union_fs.add_branch(mem_fs, ref='memory', rank=0, writable=True)\n >>> union_fs.add_branch(fslib.stacking.ReadOnlyFS(fslib.OSFS('/')), ref='os', rank=1)\n >>>\n >>> fs = fslib.FileSystem(backend=union_fs)\n >>> fs.writelines('/tmp/x', ['aa', 'bb'])\n >>>\n >>> open('/tmp/x', 'r')\n IOError: [Errno 2] No such file or directory: '/tmp/x'\n >>> fs.file_exists('/tmp/x')\n True\n >>> fs.readlines('/tmp/x')\n ['aa', 'bb']\n >>> fs.access('/tmp/x', os.F_OK)\n True\n\n\nUnix-like filesystem tree\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nIt is possible to \"overlay\" physical or virtual file systems to present\na simple, unified structure to the program.\n\n.. code-block:: pycon\n\n >>> import fslib, fslib.stacking\n >>> mnt = fslib.MountFS()\n >>> mnt.mount_fs('/', fslib.stacking.ReadOnlyFS(fslib.OSFS('/')))\n >>> mnt.mount_fs('/home/xelnor/.myapp', fslib.stacking.MemoryFS())\n >>> mnt.mount_fs('/home/xelnor/.myapp/cache', fslib.OSFS('/tmp/myapp/shared_cache'))\n\nWith this setup:\n\n- All reads/writes to ``/home/xelnor/.myapp/cache`` will actually occur within ``/tmp/myapp/shared_cache``\n- All reads/writes within ``/home/xelnor/.myapp`` (except for ``/cache``) will occur in memory\n- No write will be permitted anywhere else.", "description_content_type": null, "docs_url": null, "download_url": "https://pypi.python.org/pypi/fslib/", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rbarrois/fslib/", "keywords": "FS,FileSystem,UnionFS,os", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "fslib", "package_url": "https://pypi.org/project/fslib/", "platform": "OS Independent", "project_url": "https://pypi.org/project/fslib/", "project_urls": { "Download": "https://pypi.python.org/pypi/fslib/", "Homepage": "https://github.com/rbarrois/fslib/" }, "release_url": "https://pypi.org/project/fslib/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "Wrapper around low-level FS-related calls, with support for advanced FS stacking", "version": "0.2.1" }, "last_serial": 959963, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "f4bf30869a580c32a62021eb95890e1e", "sha256": "97f157d62b6b7f935b6daf2af929ef95b0a87ddba8be8ee52bc9479a66218312" }, "downloads": -1, "filename": "fslib-0.2.0.tar.gz", "has_sig": false, "md5_digest": "f4bf30869a580c32a62021eb95890e1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13519, "upload_time": "2014-01-03T20:00:55", "url": "https://files.pythonhosted.org/packages/dc/02/3f24fff3e82248a51e77bc8de60ba2968a0c12b87ae97d1b65ab34a5400b/fslib-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "671078e4d7e6705bb71f8f64dfc3e4b0", "sha256": "01331f04f497a8447e8ebf889e0e18dcbbb10439930f97a6f34ef363a18dd028" }, "downloads": -1, "filename": "fslib-0.2.1.tar.gz", "has_sig": false, "md5_digest": "671078e4d7e6705bb71f8f64dfc3e4b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14788, "upload_time": "2014-01-03T21:52:24", "url": "https://files.pythonhosted.org/packages/d5/a6/90065e9eb4a308d9cf33efb7b583fab79168825f17799d1bfc33c9d57d1b/fslib-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "671078e4d7e6705bb71f8f64dfc3e4b0", "sha256": "01331f04f497a8447e8ebf889e0e18dcbbb10439930f97a6f34ef363a18dd028" }, "downloads": -1, "filename": "fslib-0.2.1.tar.gz", "has_sig": false, "md5_digest": "671078e4d7e6705bb71f8f64dfc3e4b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14788, "upload_time": "2014-01-03T21:52:24", "url": "https://files.pythonhosted.org/packages/d5/a6/90065e9eb4a308d9cf33efb7b583fab79168825f17799d1bfc33c9d57d1b/fslib-0.2.1.tar.gz" } ] }