Skip to main content

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).

Metadata

Release files for posixfs 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for posixfs 1.0.1
File Size Uploaded
posixfs-1.0.1.tar.gz 4.2 kB Details

Release files / posixfs-1.0.1.tar.gz

Download URL posixfs-1.0.1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
059b7a7de8c98190f11a01c8aafa1f05991563658b8f5b8fa1f7ef6b0041b006
BLAKE2b-256 checksum
How to use checksums
e8f42edb327e9ae00bb006207858175fcf5c40f583f2718129cd602a335477db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/20.7.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.2

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page