Skip to main content

zleap_parser

zleap_parser 是 zleap 的 Python 文档解析 SDK:把本地文件或远程 HTML 转换为 Markdown,并归档为知识型 .octx 文件。当前规划基线为 M2.8 (0.2.2),普通解析与连接器取数不依赖外部事项提取或向量服务。

文档

  1. 计划总览
  2. 安装与快速上手
  3. 配置手册
  4. 文档解析 API
  5. 连接器 API
  6. 钉钉连接器与 MCP 方案
  7. 服务 API 与部署

安装

python -m pip install zleap_parser

# URL 采集首次使用时准备浏览器二进制
python -m camoufox fetch

可选能力通过 extras 安装:

python -m pip install "zleap_parser[pdf]"
python -m pip install "zleap_parser[xlsx]"
python -m pip install "zleap_parser[media]"       # 另需系统 ffmpeg
python -m pip install "zleap_parser[db-all]"
python -m pip install "zleap_parser[dingtalk-oa]" # 钉钉 OA MCP(可选)
python -m pip install "zleap_parser[dingtalk-profile]" # 钉钉加密 profile(可选)

SQLite、Markdown 归档和普通文本解析可直接运行。RTF/XLSX 预览需要系统 soffice/libreoffice;URL 采集需要 Camoufox 浏览器二进制。

最小示例

import zleap_parser
from zleap_parser import CacheConfig, Parser

zleap_parser.config(cache=CacheConfig(cache_namespace="sdk-default"))
parser = Parser()

parsed = parser.parse(file="/path/to/document.pdf")
print(parsed["result"])       # 已存在的 *.octx 路径
print(parsed["usage"])        # 完整零用量账本

csv_path = parser.pack_csv_to_octx("name,age\nAlice,30\n")
print(csv_path)

Parser.parse(url=...) 与 Parser.parse(file=...) 必须二选一。归档产物包含 knowledge/main.md、metadata 和原始附件;不会生成事项、关系或向量文件。

连接器

from zleap_parser.connector import Connector, RSSAdapter

result = Connector().fetch(
    adapter=RSSAdapter(url="https://example.com/feed.xml", limit=20)
)
print(result["results"])       # knowledge-only *.octx 路径列表
print(result["usage"])         # 普通数据源为完整零用量

内置数据源包括 RSS/WebSearch/DeepCrawl、企业微信/飞书/Salesmartly/钉钉 聊天与群列表、钉钉知识库/云盘/文档/OA 审批、邮件、API 请求、 GitHub/GitLab/Gitee 仓库、DB/BigDB。所有数据源统一使用 fetch(); 邮件额外返回邮件 OCTX 列表和 sync-cursor OCTX。

Git 仓库分析是唯一默认会调用模型的取数场景。它使用统一 LLMConfig 和 OpenAI-compatible 客户端,分析摘要写入 knowledge Markdown,代码文件作为 附件归档;usage 明细统一为 kind="llm"。

配置和多模态能力

文本及未来多模态请求统一使用 LLMConfig。supports_multimodal=False 为 默认值,只有显式设置为 True 才表示模型接受多模态消息;M2.8 不执行多模态 enrichment,不根据模型名猜测能力,也不静默降级。

CacheConfig.cache_namespace 默认 "sdk-default",参与所有缓存 key/signature。 多租户服务必须为每个任务创建独立配置快照,例如 tenant-<sha256(tenant_id) 前 32 位>,不得在并发任务中修改全局配置。

文件格式

支持文本、源码、PDF、RTF、DOCX、PPTX、XLSX、HTML、XML、图片和音视频。 格式识别优先依据内容特征;新增格式通过 BaseAdapter 插件接入。

API 变更(M2.8)

  • 保留 Parser.parse()、pack_to_octx()、pack_csv_to_octx()、 pack_xlsx_to_octx() 和 Connector.fetch()。
  • 直接删除旧的事项提取/向量入口、旧连接器组合入口及其残留模块; 不提供兼容别名、弃用警告或失败桩。
  • 移除 embedding 配置和独立视觉模型/图片处理配置;只保留 LLMConfig.supports_multimodal 能力字段。
  • OCTX metadata 写入 com.zleap.parser.archive_schema=knowledge-only/1, capability 集合显式为空。

历史需求和旧版本行为请查阅 plan/M1、plan/M2、plan/M2.5、 plan/M2.6、plan/M2.7 及 CHANGELOG.md;这些记录不构成当前安装或 API 依据。

Metadata

Release files for zleap-parser 0.2.2

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

Source distribution (sdist)

Source distribution for zleap-parser 0.2.2
File Size Uploaded Provenance
zleap_parser-0.2.2.tar.gz 31.8 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zleap-parser 0.2.2
File Interpreter ABI Platform
zleap_parser-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 MB

Release files / zleap_parser-0.2.2.tar.gz

Download URL zleap_parser-0.2.2.tar.gz
Size 31.8 MB
Tags Source
SHA-256 checksum
How to use checksums
4fd4cb628e969f602b3155f0d251a3310b876c7aace63bd95d82d4135242a5af
BLAKE2b-256 checksum
How to use checksums
ecaf02cb46a678c16425274c922914c4867341aec8a7e32be1f4f00891122e62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release files / zleap_parser-0.2.2-py3-none-any.whl

Download URL zleap_parser-0.2.2-py3-none-any.whl
Size 3.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e089472ce55adea56ecc03dd6339ee2e20b80e2b81aca90eb62c1f96ba43a506
BLAKE2b-256 checksum
How to use checksums
2daa10ae250239dd4ee2f2fb8a56f34b05a41c01de26ac26b39a811996f51f23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Security for zleap-parser 0.2.2

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.

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