Skip to main content

byoe-ontology

BYOE 本体核心包——企业系统语义层的格式、校验、版本化存储与互通,纯库、零 UI、除 pydantic 外零依赖。

来源:SimAct simact/ontology/(schema/store)+ simact/ontology/simrep_format.py(SimRep 双向桥)+ simact/exchange/(信封)的通用部分,按《BYOE_三版本规划与实施计划.md》Phase 0.2 抽取。 SimRep 侧契约参考:packages/contracts/src/ontology.ts(zod);AI 注入器 ontologyToPromptText 的 Python 移植在本包 prompt_text。

安装

pip install byoe-ontology        # 或 monorepo 内: pip install -e packages/byoe-ontology

快速开始

from byoe_ontology import Ontology, OntField, OntObject, OntologyStore, validate_ontology
from byoe_ontology.simrep_format import to_shared, from_shared
from byoe_ontology.prompt_text import prompt_text

o = Ontology(system="erp-prod", objects=[OntObject(name="Order", fields=[OntField(name="no")])])
errs = validate_ontology(o)                       # [] = 通过

store = OntologyStore(root, audit=my_audit_sink)  # 显式注入存储根与审计汇(无全局单例)
pending = store.save_draft(o, actor="fde")        # 草稿;返回待确认条目
store.confirm("erp-prod", pending, actor="fde")   # 逐条确认
ver = store.publish("erp-prod", actor="fde")      # 发布为不可变版本 v1
pkg = store.export_package("erp-prod", "fde")     # 交换包:{schemaVersion, kind, ontology, checksum}

shared = to_shared(o)                             # → SimRep OntologySchema 形态(zod 可消费)
back = from_shared(shared)                        # ← SimRep 产物导回(x-simact 无损还原)
text = prompt_text(o)                             # → AI 语义注入串(接 byoe L0 / SimRep aiOntologySuggest)

设计要点

  • 规范格式 + 扩展区:模型含 x-byoe(BYOE 规范扩展)与 x-simact(兼容保留);extra="allow" 保证未知键往返不丢。SimAct 专有信息(操作契约/风险/来源/置信度)在 SimRep 共享格式中无损写入 x-simact,SimRep zod 忽略未知键。
  • 草稿→确认→发布:发布要求全部条目确认;版本不可变;diff(a, b) 增删对比。
  • 导入只进草稿:交换包 sha256 校验和 + schemaVersion 双重校验,通过后所有条目置 draft 待确认—— 防篡改、防静默覆盖。
  • 无全局单例:root 与审计汇显式注入;宿主(byoe / SimAct)自行管理生命周期。
  • 互通即格式:与 SimRep 只交换 JSON 不共享代码;envelope.checksum/verify 提供通用包信封。

License

MIT(与 byoe 主包一致)

Metadata

Release files for byoe-ontology 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for byoe-ontology 0.1.0
File Interpreter ABI Platform Actions
byoe_ontology-0.1.0-py3-none-any.whl Python 3 none any Details for byoe_ontology-0.1.0-py3-none-any.whl

Release files / byoe_ontology-0.1.0-py3-none-any.whl

Download URL byoe_ontology-0.1.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73a14e6cf51cdc2925b95f8f3c8747691f1404da3d13c489ea45509ca6e8e43e
BLAKE2b-256 checksum
How to use checksums
30d7ce8e6a2f0e5fc21cf6e54a677fe5b8e8cd53bd7ca720ae2d00a24b7ea1b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for byoe-ontology 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page