Relational inspection and validation for Open Knowledge Format bundles
Project description
type: Project title: okf-parser description: Relational inspection and validation for Open Knowledge Format bundles
okf-parser
Relational inspection and validation for Open Knowledge Format (OKF) v0.2 bundles.
okf-parser reads an OKF bundle without imposing a domain taxonomy, preserves
unknown frontmatter fields, and exposes concepts and links as
Ibis tables. This makes bundle-wide rules—identity,
lineage, cardinality, provenance, and profile-specific constraints—expressible
as deterministic relational checks.
Why another OKF tool?
The ecosystem already has good static linters and generators, including
okflint, okf-cli, and google-okf. This project focuses on a different
layer:
- compile a bundle into queryable relational tables;
- project those same relations into a NetworkX graph;
- validate OKF v0.2 conformance without rejecting extensions;
- distinguish normative errors from advisory diagnostics;
- let projects add cross-concept rules as Ibis expressions;
- produce stable human-readable and JSON reports for CI and agents.
The parser and validation model are inspired by
franklinbaldo/sisprev: parse
documents independently from semantic validation, aggregate violations instead
of failing at the first bad concept, preserve authored bodies, and test
filesystem identity explicitly. No Sisprev-specific legal types are copied into
the core.
mrorigo/rust-okf inspired the stable
logical key, conservative metadata preservation, BOM/CRLF handling, and clean
separation between bundle parsing and downstream query surfaces. Its BM25,
vector index, storage format, and HTTP server are intentionally outside this
project's scope.
Quick start
uv sync
uv run okf-parser check path/to/bundle
uv run okf-parser inventory path/to/bundle
uv run okf-parser graph path/to/bundle
uv run okf-parser format path/to/bundle
uv run okf-parser format path/to/bundle --write
uv run okf-parser duckdb path/to/bundle knowledge.duckdb
The command exits with status 1 only when normative errors exist. Broken
cross-links are warnings because OKF v0.2 explicitly says they do not make a
bundle non-conformant.
GitHub Actions
Add the repository as a CI check:
steps:
- uses: actions/checkout@v4
- uses: franklinbaldo/okf-parser@v1
with:
path: knowledge
The composite action installs a pinned uv version and executes the same
validate_path() function used by the Python API, CLI, and MCP server.
Releases are published to PyPI from GitHub Releases through OIDC Trusted Publishing. No long-lived PyPI token is stored in the repository.
Every pull request must increase the SemVer version in pyproject.toml and add
exactly one matching changelog/<version>.md entry. CI compares both against
the target branch before allowing merge.
MCP
uv run okf-parser serve
uv run okf-parser-mcp
uv run fastmcp run
Read-only tools: check, inventory, graph, and format_check.
DuckDB
okf-parser is a regular uv-managed Python app; the DuckDB integration is part
of the same package, not a native C++ subproject:
import duckdb
from okf_parser.duckdb import attach_okf
connection = duckdb.connect("knowledge.duckdb")
attach_okf(connection, "knowledge/")
connection.sql("""
SELECT concept_type, count(*)
FROM okf.concepts
GROUP BY concept_type
""").show()
The call creates okf.concepts, okf.links, okf.reserved, and
okf.diagnostics as ordinary DuckDB tables. Use a new database or schema for
each materialization.
Python API
from pathlib import Path
from okf_parser import load_bundle, validate_path
bundle = load_bundle(Path("knowledge"))
print(bundle.concepts.execute())
print(bundle.links.execute())
print(bundle.to_networkx())
print(bundle.validate())
report = validate_path(Path("knowledge"))
assert report.markdown_count == report.concept_count + report.reserved_count
assert report.is_conformant
Current scope
- UTF-8 Markdown discovery;
- reserved
index.mdandlog.mdhandling; - strict YAML-frontmatter parsing for concept documents;
- required non-empty
type; - stable concept IDs derived from paths;
- Markdown-link extraction and resolution;
- Ibis tables for concepts, reserved documents, and links;
- NetworkX graph projection for traversal, cycles, components, and impact;
- aggregated validation reports.
Profiles, lifecycle/provenance family validation, external resources, and pluggable Ibis rules are the next milestones.
Project details
Release history Release notifications | RSS feed
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 okf_parser-0.1.0.tar.gz.
File metadata
- Download URL: okf_parser-0.1.0.tar.gz
- Upload date:
- Size: 105.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
805e3abd4c781431949afe9a94b8c89685f588fd3f4156d3553df26bf0e03663
|
|
| MD5 |
eccf9ca3a8ae64589d8dbbdc542e27d7
|
|
| BLAKE2b-256 |
d93924bd58971113803294c947fecff6bcc1527b1885dfd02a29e4e9abfbdf4c
|
Provenance
The following attestation bundles were made for okf_parser-0.1.0.tar.gz:
Publisher:
publish.yml on franklinbaldo/okf-parser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
okf_parser-0.1.0.tar.gz -
Subject digest:
805e3abd4c781431949afe9a94b8c89685f588fd3f4156d3553df26bf0e03663 - Sigstore transparency entry: 2256059065
- Sigstore integration time:
-
Permalink:
franklinbaldo/okf-parser@0a3a5fb04c323ce5dfa20c167c68e928b3bec059 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/franklinbaldo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0a3a5fb04c323ce5dfa20c167c68e928b3bec059 -
Trigger Event:
release
-
Statement type:
File details
Details for the file okf_parser-0.1.0-py3-none-any.whl.
File metadata
- Download URL: okf_parser-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86906ae58c28ed7a62f31e5e06d6fd04bbecfb69ea6dd734cc466d5d77030ec6
|
|
| MD5 |
3ee688c53d4373220c758214ad9b058e
|
|
| BLAKE2b-256 |
864edeffdd27ef9672022b438abcb2adccc119f256e118eac78f7795b8adcfcc
|
Provenance
The following attestation bundles were made for okf_parser-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on franklinbaldo/okf-parser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
okf_parser-0.1.0-py3-none-any.whl -
Subject digest:
86906ae58c28ed7a62f31e5e06d6fd04bbecfb69ea6dd734cc466d5d77030ec6 - Sigstore transparency entry: 2256059078
- Sigstore integration time:
-
Permalink:
franklinbaldo/okf-parser@0a3a5fb04c323ce5dfa20c167c68e928b3bec059 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/franklinbaldo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0a3a5fb04c323ce5dfa20c167c68e928b3bec059 -
Trigger Event:
release
-
Statement type: