Core primitives and shared mechanisms for the ai-hats framework — minimal deps, each load-bearing.
Project description
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.11+.
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 module namespace.
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_hats_core-0.4.0.tar.gz.
File metadata
- Download URL: ai_hats_core-0.4.0.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
611f5761a6320d0af870fe13cfc765d8c24ace7cdd4798c383cafbb3e7616793
|
|
| MD5 |
d874f3b703ea3ae1675ba133fca1d3a9
|
|
| BLAKE2b-256 |
cbde7fa6963a67e0b79e3f5deabe54dbd4dad49672fe26e5774577ff92fcd8b4
|
Provenance
The following attestation bundles were made for ai_hats_core-0.4.0.tar.gz:
Publisher:
release-packages.yml on muratovv/ai-hats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_hats_core-0.4.0.tar.gz -
Subject digest:
611f5761a6320d0af870fe13cfc765d8c24ace7cdd4798c383cafbb3e7616793 - Sigstore transparency entry: 2089909729
- Sigstore integration time:
-
Permalink:
muratovv/ai-hats@9818d7e01b7d6ef91304e1af8fa151553a56733c -
Branch / Tag:
refs/heads/master - Owner: https://github.com/muratovv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-packages.yml@9818d7e01b7d6ef91304e1af8fa151553a56733c -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ai_hats_core-0.4.0-py3-none-any.whl.
File metadata
- Download URL: ai_hats_core-0.4.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03f4bd4d2516f938bfab9e394a0f46cfdc6c9a5354afba5d65a44aa738e9040a
|
|
| MD5 |
f1e0fea8c52a2d1a26fe480460757696
|
|
| BLAKE2b-256 |
51663b16c619328cc476199d6e618a698be7706dbcd247d43479ed1cf95a89f2
|
Provenance
The following attestation bundles were made for ai_hats_core-0.4.0-py3-none-any.whl:
Publisher:
release-packages.yml on muratovv/ai-hats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_hats_core-0.4.0-py3-none-any.whl -
Subject digest:
03f4bd4d2516f938bfab9e394a0f46cfdc6c9a5354afba5d65a44aa738e9040a - Sigstore transparency entry: 2089909988
- Sigstore integration time:
-
Permalink:
muratovv/ai-hats@9818d7e01b7d6ef91304e1af8fa151553a56733c -
Branch / Tag:
refs/heads/master - Owner: https://github.com/muratovv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-packages.yml@9818d7e01b7d6ef91304e1af8fa151553a56733c -
Trigger Event:
workflow_dispatch
-
Statement type: