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: https://rsfile.readthedocs.io/en/latest/

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.3.tar.gz (374.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rsfile-3.3-py3-none-any.whl (397.8 kB view details)

Uploaded Python 3

File details

Details for the file rsfile-3.3.tar.gz.

File metadata

  • Download URL: rsfile-3.3.tar.gz
  • Upload date:
  • Size: 374.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for rsfile-3.3.tar.gz
Algorithm Hash digest
SHA256 d36d495bb7b16f99a02356282b374a6c874de28f3798f1a29fac264d06299021
MD5 ede7d27d5a54a2cc7eee83932feafb22
BLAKE2b-256 c693db292fdc4a289e073d685940aea4f5eea6c130125e8f45b3a5a276f57c8e

See more details on using hashes here.

File details

Details for the file rsfile-3.3-py3-none-any.whl.

File metadata

  • Download URL: rsfile-3.3-py3-none-any.whl
  • Upload date:
  • Size: 397.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for rsfile-3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c1cdb1d4f737901ddbe31eea786b6786fc98d2892b76e6cad37ed13921d0e073
MD5 58c91addf68e1a38659b7714266322a9
BLAKE2b-256 4cd2ea69b2dd822c8b4f9674ba31201dba1ad50d7a33f10f1bd74e6d612cecc5

See more details on using hashes here.

Supported by

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