Skip to main content

Advanced I/O file streams with fine-grained locking and creation options

Project description

https://ci.appveyor.com/api/projects/status/x002hlal3qwiavsa/branch/master

RSFile provides pure-python drop-in replacements for the classes of the io module, and for the open() builtin.

Its goal is to provide a cross-platform, reliable, and comprehensive synchronous file I/O API, with advanced features like fine-grained opening modes, shared/exclusive file record locking, thread-safety, disk cache synchronization, file descriptor inheritability, and handy stat getters (size, inode, times…).

Locking is performed using actual file record locking capabilities of the OS, not by using separate files/directories as locking markers, or other fragile gimmicks.

Possible use cases for this library: concurrently writing to logs without ending up with garbled data, manipulating sensitive data like disk-based databases, synchronizing heterogeneous producer/consumer processes when multiprocessing semaphores aren’t an option, etc.

Tested on CPython3, on windows and unix-like systems. Should work with IronPython/Jython/PyPy too, since it uses stdlib utilities and ctypes bridges.

Read the documentation here: http://rsfile.readthedocs.io/

INSTALL

$ pip install rsfile

QUICKSTART

from rsfile import rsopen

with rsopen("myfile.txt", "w") as f:
    f.write("This string will be veeeeeryyyyy safely written to file.")

with rsopen("myfile.txt", "WANISB", locking=False, thread_safe=False) as f:
    f.write(b"See the docs for info on these cool new modes and parameters.")

See CONTRIBUTING.rst for development advice (testing, benchmarking…)

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

RSFile-3.1.tar.gz (351.5 kB view details)

Uploaded Source

Built Distribution

RSFile-3.1-py3-none-any.whl (373.4 kB view details)

Uploaded Python 3

File details

Details for the file RSFile-3.1.tar.gz.

File metadata

  • Download URL: RSFile-3.1.tar.gz
  • Upload date:
  • Size: 351.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0b4

File hashes

Hashes for RSFile-3.1.tar.gz
Algorithm Hash digest
SHA256 4a21f508817339bd8d8e7e9cbdef9263c989179b6142cdd81697a701c881c54a
MD5 9f8838fcbf489d4b662c2efcd9ce1b6d
BLAKE2b-256 1a31ea9863a9f6289e32dfceebb0b80b5a21c8d9665de6f613b38938f6fb4d85

See more details on using hashes here.

File details

Details for the file RSFile-3.1-py3-none-any.whl.

File metadata

  • Download URL: RSFile-3.1-py3-none-any.whl
  • Upload date:
  • Size: 373.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0b4

File hashes

Hashes for RSFile-3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d19f0cd3984dcd30d89fd3739cf27dbf2a2361d58822ccf1df6a137d127519b2
MD5 f9de598238878fc1fe9fa68d3673e219
BLAKE2b-256 100e4c16eabd6c50298b8e4593cc5fab7cebba8f3c2e6c6de8a3ded7716dcf69

See more details on using hashes here.

Supported by

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