Skip to main content

Miscellaneous proxy filesystems for Pyfilesystem2

Project description

Source PyPI Travis Codecov Codacy Format License

Requirements

pyfilesystem2

PyPI fs

Source fs

License fs

six

PyPI six

Source six

License six

psutil

PyPI psutil

Source psutil

License psutil

Installation

Install directly from PyPI, using pip

pip install fs.proxy

Usage

This module revolves around the notion of proxy filesystems, akin to wrapper filesystems from the core library, but using a proxy in combination with the delegate filesystem used by WrapFS. They also make it easier to create generic wrappers, as fs.proxy.base.Proxy subclasses will use the fs.base.FS method implementation, while actually deriving from WrapFS !

This extension includes a base fs.proxy.base.Proxy class, that requires only the essential filesystem methods to be implemented.

The fs.proxy.writer package also declares two classes that can be used to make any read-only filesystem writeable, using a secondary writeable filesystem: fs.proxy.writer.ProxyWriter and fs.proxy.writer.SwapWriter. ProxyWriter will always write modifications to the secondary filesystem (often a MemoryFS or a TempFS), while SwapWriter will use a third backup filesystem in case the memory footprint of the proxy filesystem becomes too large (swapping from a MemoryFS to an OSFS, etc.). For instance, let’s pretend we can write to the root:

>>> import fs.proxy.writer

>>> read_only_fs = fs.open_fs(u'/') # this is not actually read-only ;)
>>> writeable_fs = fs.proxy.writer.ProxyWriter(read_only_fs)
>>> writeable_fs.setbytes(u'/root.txt', b'I am writing in root !')

>>> writeable_fs.exists(u'/root.txt')
True
>>> read_only_fs.exists(u'/root.txt')
False

See also

  • fs, the core pyfilesystem2 library

  • fs.sshfs, a SFTP/SSH implementation for pyfilesystem2 using paramiko

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

fs.proxy-0.1.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

fs.proxy-0.1.2-py2.py3-none-any.whl (10.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fs.proxy-0.1.2.tar.gz.

File metadata

  • Download URL: fs.proxy-0.1.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fs.proxy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d83d045a4cff50dd26246e035b6c2adf30c870dcfbf98a8273dcb49590315083
MD5 c219c2e2e0bd1e9cd5096d97512412eb
BLAKE2b-256 1edf64d5091d69971c9bb19f6792086a10557286c6e16ce4c7d798dbfe373b2d

See more details on using hashes here.

File details

Details for the file fs.proxy-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fs.proxy-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3b38fe7430fe15e09d359a84c39c430abac03a20c64da6cfdd7e3befd9fbae27
MD5 67f4d119630a8b9b400cee1db747b759
BLAKE2b-256 36384544aeccd2a2a5b78c9aa3b3886c391ded3eac24ed13d2335bd1ce2d24e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page