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…)
Metadata
Release files for RSFile 3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rsfile-3.3.tar.gz | 374.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rsfile-3.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 772.3 kB
Release files / rsfile-3.3.tar.gz
| Download URL | rsfile-3.3.tar.gz |
|---|---|
| Size | 374.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d36d495bb7b16f99a02356282b374a6c874de28f3798f1a29fac264d06299021
|
|
BLAKE2b-256 checksum How to use checksums |
c693db292fdc4a289e073d685940aea4f5eea6c130125e8f45b3a5a276f57c8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / rsfile-3.3-py3-none-any.whl
| Download URL | rsfile-3.3-py3-none-any.whl |
|---|---|
| Size | 397.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1cdb1d4f737901ddbe31eea786b6786fc98d2892b76e6cad37ed13921d0e073
|
|
BLAKE2b-256 checksum How to use checksums |
4cd2ea69b2dd822c8b4f9674ba31201dba1ad50d7a33f10f1bd74e6d612cecc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|