--- id: atomicwrites version: "1.4.1" license: MIT license_treatment: permissive maintenance: abandoned --- # atomicwrites — Atomic file writes. License: permissive · Maintenance: abandoned · Downloads: 4.8M/mo ## What it is and what it does Atomicwrites provides a simple context manager that ensures file writes complete fully or not at all, preventing corruption from interrupted writes or concurrent access. It works by writing to a temporary file in the same directory, then atomically moving it to the target location using platform-specific operations: rename on POSIX systems (with optional link-and-unlink for non-overwrite cases), and MoveFileEx on Windows via ctypes. The library includes fsync calls to flush both file content and directory metadata on POSIX systems, and _commit on Windows, though it does not guarantee protection against disk-level buffering. The package has no runtime dependencies and supports Python 2.7 and 3.4 through 3.8 according to its classifiers. It is designed to be a lightweight, cross-platform alternative to manual temp-file-and-rename patterns, with a high-level API wrapping a flexible class-based interface. However, the project is abandoned and has not been updated since July 2022, meaning new Python versions, security issues, and platform changes will not be addressed. Use it for: - Writing configuration files or state that must not be left in a partial or corrupted state if the process crashes or is interrupted. - Coordinating file updates across multiple processes or threads where a partially-written file could cause readers to fail or see inconsistent data. - Ensuring database-like durability for single-file data stores or caches that require atomic all-or-nothing semantics. - Cross-platform applications that need consistent atomic-write behavior on both POSIX and Windows without platform-specific code. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a context manager for writing files atomically—writing to a temporary file first, then moving it to the target location in a single operation to prevent partial or corrupted writes. No. The package is abandoned (last updated July 2022, repository archived) and will not receive security patches or compatibility fixes for modern Python versions. While the core functionality is simple and has no dependencies, the lack of maintenance makes it unsuitable for new projects. Consider using a maintained alternative or implementing atomic writes directly with tempfile and os.replace, which is available in the standard library. ## Install pip install atomicwrites uv add atomicwrites poetry add atomicwrites ## Installing atomicwrites Before you install: High install friction; the package is abandoned (last commit 2022-07-08, repository archived) and has not been updated in over 1498 days. No runtime dependencies, but the lack of maintenance means security issues or compatibility problems with newer Python versions will not be addressed. License in practice: MIT license is permissive and imposes no restrictions on use, modification, or distribution in proprietary or commercial projects. Quickstart: from atomicwrites import atomic_write with atomic_write('foo.txt', overwrite=True) as f: f.write('Hello world.') Verify before relying: - Whether the package works reliably on modern Python versions (3.9+) given its abandonment since 2022. - Whether Windows atomicity guarantees hold on current NTFS implementations, given the documented uncertainty in the MSDN comment cited. - Whether fsync behavior on modern filesystems and SSDs provides the durability guarantees the documentation implies. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: high - Maintenance: abandoned - Downloads: 4.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags atomic file write, safe file writing, temporary file rename, prevent partial writes, race-free file operations, cross-platform atomic rename, fsync file durability, file-io, abandoned [View on SkillFed](https://skillfed.io/packages/atomicwrites) · [View on PyPI](https://pypi.org/project/atomicwrites/)