ai-hats-core
Core primitives and shared mechanisms for the ai-hats framework — minimal dependencies, each load-bearing (currently exactly one: pydantic). No domain schemas: each ai-hats package owns its own.
It ships five mechanisms:
- Atomic file writes —
atomic_write_text/atomic_write_bytes: unique-tmp-in-same-dir +os.replace, so a reader never observes a half-written file and a crash never leaves a truncated one. - Composition value-types —
CompositionResult/ResolvedComponent(frozen dataclasses) + theComponentKindenum: the immutable result contract of role assembly, composed once by the integrator and injected down into packages. - YAML model base —
YamlModel: pydantic base for YAML-round-trippable models (to_dict/from_dict,extra="ignore"). - Git-env hygiene —
scrubbed_git_env():os.environcopy minus the threeGIT_*plumbing vars that retarget cwd-scoped git subprocesses. - Safe deletion —
ai_hats_core.safe_delete: trash-bin destructive ops (discard/replace) instead of rawunlink/rmtree, with a per-process session and recovery summary.
Install
pip install ai-hats-core
Requires Python 3.13+.
Usage
from pathlib import Path
from ai_hats_core import atomic_write_text, scrubbed_git_env
atomic_write_text(Path("config.json"), '{"ok": true}\n')
import subprocess
subprocess.run(["git", "status"], cwd=Path("."), env=scrubbed_git_env())
Public API
ai_hats_core.__all__:
atomic_write_text(path, text, *, mode=None)/atomic_write_bytes(path, data, *, mode=None)CompositionResult/ResolvedComponent/ComponentKindYamlModelscrubbed_git_env()
plus the ai_hats_core.safe_delete and ai_hats_core.lazy module namespaces.
lazy.lazy_facade builds the __getattr__/__dir__ pair a package needs to bind
its exports on first use.
Dependencies
pydantic>=2 — the base of the model layer. Nothing else.
Versioning
SemVer. The public API is ai_hats_core.__all__ +
ai_hats_core.safe_delete + ai_hats_core.lazy.
License
MIT. See the ai-hats repository.
Metadata
Release files for ai-hats-core 0.14.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ai_hats_core-0.14.0.tar.gz | 39.3 kB | With provenance | Details for ai_hats_core-0.14.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ai_hats_core-0.14.0-py3-none-any.whl | Python 3 | none | any | Details for ai_hats_core-0.14.0-py3-none-any.whl |
Total release size: 68.5 kB
Release files / ai_hats_core-0.14.0.tar.gz
| Download URL | ai_hats_core-0.14.0.tar.gz |
|---|---|
| Size | 39.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0a1f7b30fb8e5e0e349421722bb165469eac11564efdbd723605d47ddbcb859
|
|
BLAKE2b-256 checksum How to use checksums |
c7258865e6e7008b1123f57df4a2c9d76e8e8217c0b0cc1bbd9430160c308bfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logRelease files / ai_hats_core-0.14.0-py3-none-any.whl
| Download URL | ai_hats_core-0.14.0-py3-none-any.whl |
|---|---|
| Size | 29.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d37ff50d814827df1e0d3fa594b51f7298bcd321b7da871e89be88c0abd59cd3
|
|
BLAKE2b-256 checksum How to use checksums |
8306ba63f41050046683bf9c375fe5f66668a667d2be6b5b764cfc4fe09bda2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logSecurity for ai-hats-core 0.14.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ai_hats_core-0.14.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.