Tinche / aiofiles

File support for asyncio
Apache License 2.0
2.83k stars 152 forks source link

Atomic writes with aiofiles #5

Closed ludovic-gasc closed 8 years ago

ludovic-gasc commented 8 years ago

Hi,

For a project, I need to have atomic writes for files. I've found this library: https://github.com/untitaker/python-atomicwrites

I don't see an obvious way to integrate python-atomicwrites with aiofiles.

What's your recommended approach ? Use python-atomicwrites with a threadpool, or fork aiofiles to use python-atomicwrites ? Other approach ?

Have a nice day.

Tinche commented 8 years ago

Interesting.

This looks a little specific, so I wouldn't want to make it a dependency of aiofiles, and add support for it directly in aiofiles.

If you want to contribute, an aiofiles extra could be made. So you'd have to pip install aiofiles[atomicwrites] and then there'd be aiofiles support for atomic writes.

Easiest solution in the short term would be just to use python-atomicwrites with an executor.

ludovic-gasc commented 8 years ago

Ok, thanks for your answer.

I'll see if we have enough time to propose a pull request for that or use directly threadpool.