Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e87f656fc | |||
| d3a3bccfbb | |||
| 9ec25d27d0 |
7 changed files with 33 additions and 5 deletions
|
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||
|
||||
[project]
|
||||
name = "llm-ingestion-okf"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
description = "Shared OKF (Open Knowledge Format) ingestion library: spec-based connectors, bundle inbox, and external-bundle import, with security delegated to llm-ingestion-guard."
|
||||
readme = "README.md"
|
||||
license = "MIT"
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ from .manifest import (
|
|||
)
|
||||
from .materialize import IngestResult, materialize_bundle
|
||||
|
||||
__version__ = "0.1.0"
|
||||
__version__ = "0.2.0"
|
||||
|
||||
__all__ = [
|
||||
"Extraction",
|
||||
|
|
|
|||
|
|
@ -42,9 +42,11 @@ _MANAGED_LINE_RE = re.compile(r"^- \[(?P<label>[^\]]*)\]\((?P<target>[^)]+)\)$")
|
|||
|
||||
@dataclass(frozen=True)
|
||||
class IngestResult:
|
||||
"""The concept files written by one materialization run."""
|
||||
"""The concept files written by one materialization run, and the §5
|
||||
provenance stamp (`{stem}@{sha256(raw)[:16]}`) they were stamped with."""
|
||||
|
||||
written: tuple[Path, ...]
|
||||
stamp: str
|
||||
|
||||
|
||||
def _render_frontmatter(frontmatter: dict[str, str]) -> str:
|
||||
|
|
@ -268,4 +270,4 @@ def materialize_bundle(
|
|||
_update_index_lines(index_path, owned - staged_names, labels_by_target)
|
||||
for extraction in manifest.extractions:
|
||||
_link_in_index(bundle, generated_filename(extraction.id), extraction.title)
|
||||
return IngestResult(written=written)
|
||||
return IngestResult(written=written, stamp=stamp)
|
||||
|
|
|
|||
0
src/llm_ingestion_okf/py.typed
Normal file
0
src/llm_ingestion_okf/py.typed
Normal file
|
|
@ -131,6 +131,16 @@ def test_result_lists_written_concept_files(file_setup: tuple[Path, Path]) -> No
|
|||
assert result.written == (bundle / "ingest-orders.md",)
|
||||
|
||||
|
||||
def test_result_exposes_manifest_stamp(file_setup: tuple[Path, Path]) -> None:
|
||||
"""The §5 provenance stamp ({stem}@{sha256(raw)[:16]}) is returned on the
|
||||
result so consumers never have to recompute it from the manifest bytes."""
|
||||
manifest_path, bundle = file_setup
|
||||
result = materialize_bundle(manifest_path, bundle, INGESTED_AT)
|
||||
assert result.stamp == stamp_of(manifest_path)
|
||||
content = (bundle / "ingest-orders.md").read_text(encoding="utf-8")
|
||||
assert f"ingest_manifest: {result.stamp}\n" in content
|
||||
|
||||
|
||||
def test_relative_root_resolves_against_manifest_dir(
|
||||
tmp_path: Path, file_setup: tuple[Path, Path], monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
|
|
|
|||
16
tests/test_packaging.py
Normal file
16
tests/test_packaging.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"""Packaging contract: the library is a PEP 561 typed package.
|
||||
|
||||
Consumers run mypy --strict against the inline annotations; without the
|
||||
py.typed marker mypy degrades every imported symbol to Any.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import llm_ingestion_okf
|
||||
|
||||
|
||||
def test_package_ships_py_typed_marker() -> None:
|
||||
package_dir = Path(llm_ingestion_okf.__file__).parent
|
||||
assert (package_dir / "py.typed").is_file()
|
||||
2
uv.lock
generated
2
uv.lock
generated
|
|
@ -166,7 +166,7 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "llm-ingestion-okf"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
source = { editable = "." }
|
||||
|
||||
[package.dev-dependencies]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue