Skip to content

datalib/atomicio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo AtomicIO

https://travis-ci.org/datalib/atomicio.svg?branch=master

A 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.

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.

Releases

No releases published

Packages

No packages published

Languages