Writeable file object that atomically updates a file.
Project description
Writeable file object that atomically updates a file.
All writes will go to a temporary file. Call close() explicitly when you are done writing, and AtomicFile will rename the temporary copy to the original name, making the changes visible. If the object is destroyed without being closed, all your writes are discarded.
AtomicFile is friendly to with statement.
from atomicfile import AtomicFile with AtomicFile("panic.txt", "w") as f: f.write(json.dumps(big_data_array_100MB, sort_keys=True, indent=4))
Install
To install AtomicFile, simply:
pip install atomicfile
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
atomicfile-1.0.1.tar.gz
(2.3 kB
view details)
Built Distribution
File details
Details for the file atomicfile-1.0.1.tar.gz
.
File metadata
- Download URL: atomicfile-1.0.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 190502c5c0b1145f5c294e0be07a9f029d8ea728a0d0806e0ca466467208763e |
|
MD5 | 0bacfa3e4c8ca7fbe951388d4dc50a30 |
|
BLAKE2b-256 | 550f01130bdbdcfe15345eba5cf256d9dd73ec5f19e1178e2d630a77aa68654f |
File details
Details for the file atomicfile-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: atomicfile-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcd84786e43a60e74fa60ad456bca0a58a3c1bff9d6cbba887fd0e760ad4710b |
|
MD5 | d4db0fef48b294fcac66220a7b422c26 |
|
BLAKE2b-256 | 0ccd40710daa37980e0fa5f7246cb01452ddfdd7fe69a5ef4b658de0587d9883 |