Compatibility layer for legacy atomicwrites users, powered by safeatomic.
The original atomicwrites project by Markus Unterwaditzer is no longer maintained after PyPI's 2FA enforcement.
This repository is a from-scratch rewrite that keeps the historic atomicwrites API but delegates all file operations to the actively maintained safeatomic package.
- Preserve drop-in compatibility with existing
atomicwrites-based code. - Allow seamless migration to
safeatomicwithout changing existing imports. - Maintain API stability for projects that cannot refactor immediately.
pip install https://github.com/atomic-libs/safeatomic
pip install https://github.com/atomic-libs/python-atomicwritesNote: The
python-atomicwritespackage is just a thin wrapper and requiressafeatomicto be installed.
The API matches the original atomicwrites module:
from atomicwrites import atomic_write, replace_atomic, move_atomic, AtomicWriter
# Write atomically to a file
with atomic_write("example.txt", overwrite=True) as f:
f.write("Hello, world!")
# Replace a file atomically
replace_atomic("temp.txt", "target.txt")
# Move a file atomically
move_atomic("source.txt", "destination.txt")- Original unmaintained repo: untitaker/python-atomicwrites
- PyPI page: atomicwrites