Skip to main content

provides atomic and durable writes on a posix file system.

Project description

posixfs

posixfs provides context managers and functions to manipulate files on a POSIX file system with atomicity and durability. The module is intended to be simple and straightforward to use.

The module is written in Python 3 with types annotated and using pathlib.Path.

Usage

import pathlib

import posixfs

# write bytes to a file atomically and durably
pth = pathlib.Path("/some/file.txt")
posixfs.atomic_write_bytes(path=pth, data=b"hello", durable=True)

# write text to a file atomically and durably
posixfs.atomic_write_bytes(path=pth, text="hello", durable=True)

# use context manager
with posixfs.AtomicWritingText(path=pth, durable=True) as file:
    file.write('hello\n')
    file.write('how do you do?\n')

Installation

  • Create a virtual environment:

python3 -m venv venv3
  • Activate it:

source venv3/bin/activate
  • Install posixfs with pip:

pip3 install posixfs

Development

  • Check out the repository.

  • In the repository root, create the virtual environment:

python3 -m venv venv3
  • Activate the virtual environment:

source venv3/bin/activate
  • Install the development dependencies:

pip3 install -e .[dev]
  • We use tox for testing and packaging the distribution. Assuming that the virtual environment has been activated and the development dependencies have been installed, run:

tox
  • We also provide a set of pre-commit checks that lint and check code for formatting. Run them locally from an activated virtual environment with development dependencies:

./precommit.py
  • The pre-commit script can also automatically format the code:

./precommit.py  --overwrite

Versioning

We follow Semantic Versioning. The version X.Y.Z indicates:

  • X is the major version (backward-incompatible),

  • Y is the minor version (backward-compatible), and

  • Z is the patch version (backward-compatible bug fix).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

posixfs-1.0.0.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file posixfs-1.0.0.tar.gz.

File metadata

  • Download URL: posixfs-1.0.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for posixfs-1.0.0.tar.gz
Algorithm Hash digest
SHA256 17f6a91d246b7afe23f342704f0b27ceca5787df1dfeb1fe052761f9197708df
MD5 3b70e3e4028f8988f22884301cddd1ed
BLAKE2b-256 1f43976d2938f902466729f43c64f5dcfc544367ff44f1d0ccfd2f7b4c8ae613

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page