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 preserves the historic atomicwrites API while delegating 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.
- safeatomic (installed from GitHub)
- click >= 8.2.1
For development (includes dev dependencies):
pip install -e .[dev] git+https://github.com/atomic-libs/safeatomic.gitFor runtime only:
pip install git+https://github.com/atomic-libs/safeatomic.git
pip install python-atomicwritesFor development:
uv pip install -e .[dev]Note:
safeatomicis pulled directly from GitHub via[tool.uv.sources]inpyproject.toml.
For runtime only:
uv pip install python-atomicwritesThe 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
If you want, I can also prepare a matching **`requirements.txt`** so that both `pip install -r requirements.txt` and `uv pip install -r requirements.txt` work out-of-the-box.
Do you want me to generate that file too?