Skip to main content

Dependency-free core primitives for the ai-hats framework (atomic filesystem I/O).

Project description

ai-hats-core

Dependency-free core primitives for the ai-hats framework — pure standard library, zero third-party dependencies.

Today it ships the canonical atomic file-write helper: write to a unique temp file in the same directory, then os.replace it into place, so a reader never observes a half-written file and a crash never leaves a truncated one.

Install

pip install ai-hats-core

Requires Python 3.11+.

Usage

from pathlib import Path
from ai_hats_core import atomic_write_text, atomic_write_bytes

atomic_write_text(Path("config.json"), '{"ok": true}\n')
atomic_write_bytes(Path("data.bin"), b"\x00\x01", mode=0o600)

Both helpers write atomically (unique-tmp-in-same-dir + os.replace); pass mode to set explicit permissions, otherwise the file lands with the umask default.

Public API

ai_hats_core.__all__:

  • atomic_write_text(path, text, *, mode=None)
  • atomic_write_bytes(path, data, *, mode=None)

Dependencies

None — standard library only.

Versioning

SemVer. The public API is ai_hats_core.__all__.

License

MIT. See the ai-hats repository.

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

ai_hats_core-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_hats_core-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file ai_hats_core-0.1.0.tar.gz.

File metadata

  • Download URL: ai_hats_core-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_hats_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d9739f1e9429ec26be6a61902eb7e8d1d1242d73ecee18c3014c2083c39e13d
MD5 6b126dd79c2eb53505ecbe200d183b32
BLAKE2b-256 25c4c5a5059d293c423c5a1b3291ad7031f8638baf3e5dcb7faaa9c5394321c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_hats_core-0.1.0.tar.gz:

Publisher: release-packages.yml on muratovv/ai-hats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_hats_core-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ai_hats_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_hats_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c066b60dc067d550aad5b3bd910794ace15a6019cc8d239db123a90b71bc7d8
MD5 2651d00838cc520639e7e29409d80c91
BLAKE2b-256 e956c5a43b2448b5177945a1edacc13b8338d2494f959629abdbf0efb414b1ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_hats_core-0.1.0-py3-none-any.whl:

Publisher: release-packages.yml on muratovv/ai-hats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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