I'm pleased to announce version 2.2 of RSFile I/O Library, which adds support for python3.6 and python3.7, and fixes some corner cases when using PIPEs.
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, 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. Unix users might particularly be interested by the workaround that this library provides, concerning the weird semantic of fcntl() locks (when any descriptor to a disk file is closed, the process loses ALL locks acquired on this file through any descriptor).
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…
Tested on python2.7 and python3.5+, on windows and unix-like systems. Should work with IronPython/Jython/PyPy too, since it uses stdlib utilities and ctypes bridges.
regards, Pascal Chambon