okf-core 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. okf_core-0.3.0/.gitignore +37 -0
  2. okf_core-0.3.0/PKG-INFO +18 -0
  3. okf_core-0.3.0/README.md +9 -0
  4. okf_core-0.3.0/pyproject.toml +17 -0
  5. okf_core-0.3.0/src/okf_core/__init__.py +110 -0
  6. okf_core-0.3.0/src/okf_core/_version.py +1 -0
  7. okf_core-0.3.0/src/okf_core/ask.py +512 -0
  8. okf_core-0.3.0/src/okf_core/bundle.py +83 -0
  9. okf_core-0.3.0/src/okf_core/cache.py +79 -0
  10. okf_core-0.3.0/src/okf_core/canonical.py +176 -0
  11. okf_core-0.3.0/src/okf_core/explorer.py +386 -0
  12. okf_core-0.3.0/src/okf_core/findings.py +78 -0
  13. okf_core-0.3.0/src/okf_core/frontmatter.py +196 -0
  14. okf_core-0.3.0/src/okf_core/indexing.py +325 -0
  15. okf_core-0.3.0/src/okf_core/links.py +62 -0
  16. okf_core-0.3.0/src/okf_core/lint.py +536 -0
  17. okf_core-0.3.0/src/okf_core/packer.py +130 -0
  18. okf_core-0.3.0/src/okf_core/pipeline.py +566 -0
  19. okf_core-0.3.0/src/okf_core/provider.py +80 -0
  20. okf_core-0.3.0/src/okf_core/py.typed +0 -0
  21. okf_core-0.3.0/src/okf_core/rag.py +179 -0
  22. okf_core-0.3.0/src/okf_core/revision.py +137 -0
  23. okf_core-0.3.0/src/okf_core/viz.py +310 -0
  24. okf_core-0.3.0/tests/conftest.py +16 -0
  25. okf_core-0.3.0/tests/test_ask.py +205 -0
  26. okf_core-0.3.0/tests/test_ask_generated_spec.py +72 -0
  27. okf_core-0.3.0/tests/test_canonical.py +41 -0
  28. okf_core-0.3.0/tests/test_explorer.py +334 -0
  29. okf_core-0.3.0/tests/test_frontmatter.py +76 -0
  30. okf_core-0.3.0/tests/test_indexing.py +184 -0
  31. okf_core-0.3.0/tests/test_injected_sources.py +77 -0
  32. okf_core-0.3.0/tests/test_lint_golden.py +47 -0
  33. okf_core-0.3.0/tests/test_packer.py +90 -0
  34. okf_core-0.3.0/tests/test_pipeline_build.py +193 -0
  35. okf_core-0.3.0/tests/test_prompt_injection_corpus.py +139 -0
  36. okf_core-0.3.0/tests/test_provider_cache.py +63 -0
  37. okf_core-0.3.0/tests/test_rag.py +207 -0
  38. okf_core-0.3.0/tests/test_section_digest.py +151 -0
  39. okf_core-0.3.0/tests/test_upstream_bundles.py +89 -0
  40. okf_core-0.3.0/tests/test_viz.py +100 -0
@@ -0,0 +1,37 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .venv/
6
+ .mypy_cache/
7
+ .ruff_cache/
8
+ .pytest_cache/
9
+ dist/
10
+ build/
11
+
12
+ # Node / Next.js
13
+ node_modules/
14
+ .next/
15
+ out/
16
+ *.tsbuildinfo
17
+
18
+ # Local derived bundle state (never committed; excluded from pack)
19
+ .oknoll/
20
+
21
+ # Terraform
22
+ .terraform/
23
+ *.tfstate
24
+ *.tfstate.*
25
+ *.tfvars
26
+ !*.auto.tfvars.example
27
+ crash.log
28
+
29
+ # Environment / secrets
30
+ .env
31
+ .env.*
32
+ !.env.example
33
+
34
+ # OS / editor
35
+ .DS_Store
36
+ .idea/
37
+ .vscode/
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: okf-core
3
+ Version: 0.3.0
4
+ Summary: OpenKnoll core: CanonicalDoc, OKF v0.2 parser/writer, lint, pipeline, indexes, packer
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.12
7
+ Requires-Dist: pyyaml>=6.0
8
+ Description-Content-Type: text/markdown
9
+
10
+ # okf-core
11
+
12
+ OpenKnoll core library: the `CanonicalDoc` model, OKF v0.2 parser/writer,
13
+ 5-level lint, build pipeline (acquire → normalize → plan → generate → link →
14
+ lint → index → publish), deterministic explorer, ask policy, RAG seam, and
15
+ packer. Structurally network-free — real providers live in `oknoll-providers`.
16
+
17
+ Usually consumed through the [`oknoll`](https://pypi.org/project/oknoll/) CLI.
18
+ Part of [OpenKnoll](https://github.com/openknoll/oknoll-python).
@@ -0,0 +1,9 @@
1
+ # okf-core
2
+
3
+ OpenKnoll core library: the `CanonicalDoc` model, OKF v0.2 parser/writer,
4
+ 5-level lint, build pipeline (acquire → normalize → plan → generate → link →
5
+ lint → index → publish), deterministic explorer, ask policy, RAG seam, and
6
+ packer. Structurally network-free — real providers live in `oknoll-providers`.
7
+
8
+ Usually consumed through the [`oknoll`](https://pypi.org/project/oknoll/) CLI.
9
+ Part of [OpenKnoll](https://github.com/openknoll/oknoll-python).
@@ -0,0 +1,17 @@
1
+ [project]
2
+ name = "okf-core"
3
+ version = "0.3.0"
4
+ description = "OpenKnoll core: CanonicalDoc, OKF v0.2 parser/writer, lint, pipeline, indexes, packer"
5
+ requires-python = ">=3.12"
6
+ license = "Apache-2.0"
7
+ readme = "README.md"
8
+ dependencies = [
9
+ "pyyaml>=6.0",
10
+ ]
11
+
12
+ [build-system]
13
+ requires = ["hatchling"]
14
+ build-backend = "hatchling.build"
15
+
16
+ [tool.hatch.build.targets.wheel]
17
+ packages = ["src/okf_core"]
@@ -0,0 +1,110 @@
1
+ """okf-core: CanonicalDoc, OKF v0.2 parser/writer, five-level lint, pipeline,
2
+ revisions, packer.
3
+
4
+ The heart of OpenKnoll — the CLI and the cloud pipeline job run this identical
5
+ code.
6
+ """
7
+
8
+ from okf_core._version import __version__
9
+ from okf_core.ask import AskResult, Citation, answer_question, write_trace
10
+ from okf_core.cache import BuildCache
11
+ from okf_core.canonical import (
12
+ Anchor,
13
+ Block,
14
+ CanonicalDoc,
15
+ Link,
16
+ MediaRef,
17
+ SourceRef,
18
+ sha256_hex,
19
+ )
20
+ from okf_core.explorer import Explorer, ExplorerError
21
+ from okf_core.findings import Finding, Level, LintReport, Severity
22
+ from okf_core.frontmatter import (
23
+ KNOWN_KEY_ORDER,
24
+ STATUS_VALUES,
25
+ Frontmatter,
26
+ FrontmatterError,
27
+ FrontmatterShapeError,
28
+ FrontmatterYamlError,
29
+ ParsedDocument,
30
+ parse_document,
31
+ write_document,
32
+ )
33
+ from okf_core.indexing import build_link_graph, ensure_index, search_index, write_index
34
+ from okf_core.lint import LintConfig, lint_bundle
35
+ from okf_core.packer import PackResult, pack_bundle, strip_okf_fields
36
+ from okf_core.pipeline import (
37
+ BuildOutcome,
38
+ PipelineError,
39
+ PipelineSource,
40
+ build_revision,
41
+ check_reproducibility,
42
+ )
43
+ from okf_core.provider import (
44
+ GENERATOR_VERSION,
45
+ ModelProvider,
46
+ StubModelProvider,
47
+ generation_cache_key,
48
+ resolve_provider,
49
+ )
50
+ from okf_core.rag import EmbeddingProvider, StubEmbeddingProvider, resolve_embedder
51
+ from okf_core.revision import read_current_revision_id, revision_dir
52
+ from okf_core.viz import build_graph, render_html, write_viz
53
+
54
+ __all__ = [
55
+ "GENERATOR_VERSION",
56
+ "KNOWN_KEY_ORDER",
57
+ "STATUS_VALUES",
58
+ "Anchor",
59
+ "AskResult",
60
+ "Block",
61
+ "BuildCache",
62
+ "BuildOutcome",
63
+ "CanonicalDoc",
64
+ "Citation",
65
+ "EmbeddingProvider",
66
+ "Explorer",
67
+ "ExplorerError",
68
+ "Finding",
69
+ "Frontmatter",
70
+ "FrontmatterError",
71
+ "FrontmatterShapeError",
72
+ "FrontmatterYamlError",
73
+ "Level",
74
+ "Link",
75
+ "LintConfig",
76
+ "LintReport",
77
+ "MediaRef",
78
+ "ModelProvider",
79
+ "PackResult",
80
+ "ParsedDocument",
81
+ "PipelineError",
82
+ "PipelineSource",
83
+ "Severity",
84
+ "SourceRef",
85
+ "StubEmbeddingProvider",
86
+ "StubModelProvider",
87
+ "__version__",
88
+ "answer_question",
89
+ "build_graph",
90
+ "build_link_graph",
91
+ "build_revision",
92
+ "check_reproducibility",
93
+ "ensure_index",
94
+ "generation_cache_key",
95
+ "lint_bundle",
96
+ "pack_bundle",
97
+ "parse_document",
98
+ "read_current_revision_id",
99
+ "render_html",
100
+ "resolve_embedder",
101
+ "resolve_provider",
102
+ "revision_dir",
103
+ "search_index",
104
+ "sha256_hex",
105
+ "strip_okf_fields",
106
+ "write_document",
107
+ "write_index",
108
+ "write_trace",
109
+ "write_viz",
110
+ ]
@@ -0,0 +1 @@
1
+ __version__ = "0.3.0"