Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/datalib/atomicio
Atomic writes to files
https://github.com/datalib/atomicio
Last synced: 23 days ago
JSON representation
Atomic writes to files
- Host: GitHub
- URL: https://github.com/datalib/atomicio
- Owner: datalib
- License: mit
- Created: 2015-04-25T09:48:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-05T13:49:44.000Z (over 9 years ago)
- Last Synced: 2024-08-04T04:04:56.889Z (4 months ago)
- Language: Python
- Size: 184 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - atomicio - Atomic writes to files (Python)
README
|logo| AtomicIO
===============.. image:: https://travis-ci.org/datalib/atomicio.svg?branch=master
:target: https://travis-ci.org/datalib/atomicioA library for making atomic file writes. Basically it guarantees
that the data is not partially written to the file (hence corrupting
it in case an exception is raised) by writing to a temporary file
that gets renamed and deleted after writing... code-block:: python
from atomicio.api import atomic_write
with atomic_write(path) as (r,w):
for item in r:
w.write(process(item))There are many other libraries that provide this functionality in
Python. This library's approach and API is inspired by `fatomic`_
and `python-atomicwrites`_ respectively. So far atomicio has not
been tested on Windows but it shouldn't work because currently,
``os.rename`` does not work on already created files... _fatomic: https://github.com/abarnert/fatomic
.. _python-atomicwrites: https://github.com/untitaker/python-atomicwrites
.. |logo| image:: https://raw.githubusercontent.com/datalib/atomicio/master/media/logo-small.png