ikc-video-sdk
IKC 视频引擎(ikc-video-service)的独立客户端 SDK 分发(导入包 ikc_video_sdk)。
- 与
ikc-video服务端 wheel 中的ikc_video_sdk同源(force-include自../src/ikc_video_sdk),版本号保持一致; - 供下游(pipeline / ikc-open-platform 等)以正常依赖模式引用,无需安装服务端重型依赖(celery/redis/fastapi/pyuploadx 等);
- 能力面:typed 视频资源方法(V-01 异步切片、V-02 同步处理)+ 系统路由(
/、/health、/ready、/api/catalog、/api/error-codes)+ 泛化client.request; 统一响应壳解包与类型化异常;身份信任头 / Bearer / 23 位 traceId / 幂等重试装配。
用法与资源清单见 docs/客户端SDK设计与使用.md。
跨层能力来自 ikc-sdk-lib(不自定义)
| 能力 | 来源 |
|---|---|
| traceId 生成/校验/提取(23 位纯数字) | ikc_sdk.core.trace |
| trace 头与身份信任头常量 | ikc_sdk.core.headers |
通用稳定错误码(000000/100001/100401/…/999999) |
ikc_sdk.core.codes |
| SDK 异常基类(家族统一兜底捕获) | ikc_sdk.core.exceptions.IkcSdkError |
视频域 260xxx 与下游 509xxx 码字面量由本 SDK 的 ikc_video_sdk.codes 发布,
与服务端 registry(/api/error-codes)的一致性由 tests/test_sdk_contract.py 守护。
安装
pip install ikc-video-sdk==0.1.1
# 内网/离线:用随仓库归档的 wheel(同源同版本)
pip install /home/sharkyai/ikc-video-service/sdk/dist/ikc_video_sdk-0.1.1-py3-none-any.whl
快速开始
from ikc_video_sdk import IkCVideoClient
with IkCVideoClient("http://127.0.0.1:19200", token="dev-token") as client:
print(client.system.health()) # {"status": "ok", ...}
# V-01 异步切片:请求体嵌套 media(与 V-02 的扁平形状不同,由 SliceRequest 固化)
accepted = client.video.slice(
media={"source_format": "mp4", "object_key": "mm/video/a.mp4"}, mode="scene"
)
print(accepted.taskId) # 结果由上游按 taskId 获取
# V-02 同步处理:扁平请求体,阻塞至 mm-schema 清单产出
result = client.video.process(object_key="mm/video/a.mp4", klgId="klg_1")
print(result.manifest_key, len(result.segments))
入参三选一:请求模型(
SliceRequest/VideoProcessRequest,SDK 侧即校验)、 线缆 dict(原样透传,服务端校验)、关键字字段(按模型校验后只发显式传入的字段)。 V-01 的媒体来源在media下(media.object_key/media.input_url二选一), V-02 则在顶层,传错形状会得到100001。
异步版方法同名(AsyncIkCVideoClient),生产(IKC_VIDEO_AUTH_MODE=gateway_header)
传 identity=CallerIdentity(user_id=..., tenant_id=...) 以透传信任头。
版本与兼容性
| ikc-video-sdk | 依赖 ikc-sdk-lib | 说明 |
|---|---|---|
0.1.0 |
==0.12.1 |
首个独立分发版本(对齐 ikc-video 0.1.0) |
0.1.1 |
==0.12.1 |
文档同步:V-01 taskId 即 video.process 任务 id(服务端单跳投递,一次轮询取结果) |
升级
ikc-sdk-libpin 属兼容性变更,须与服务端pyproject.toml同步; 所有涉及 Celery 的依赖组另受/home/sharkyai/依赖版本强制契约.md约束(SDK 不引入 celery)。
发布到 PyPI
bash scripts/publish_sdk.sh # 构建 + 产物校验(不上传)
bash scripts/publish_sdk.sh --upload # 构建 + 校验 + 上传正式 PyPI(不可逆)
bash scripts/publish_sdk.sh --upload --test # 上传 TestPyPI(需其独立 token)
凭证取已 gitignore 的 config/pypi.env(模板 config/pypi.env.example)——全组织各仓库
(ikc-sdk-lib / ikc-ai-gateway / PyUploadX / openwiki-server 与本仓)共用同一个公共
PyPI 账号。发布后校验:pip install ikc-video-sdk==<version>。
分发形态:本包只发布 wheel(
sdk/dist/ikc_video_sdk-<version>-py3-none-any.whl)。 sdist 在「由 sdist 重建 wheel」时会因force-include的相对路径(../src/ikc_video_sdk)失效而失败,故不上传 sdist。
Metadata
Release files for ikc-video-sdk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ikc_video_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ikc_video_sdk-0.1.1-py3-none-any.whl |
Release files / ikc_video_sdk-0.1.1-py3-none-any.whl
| Download URL | ikc_video_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 24.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d7f1d55a07dbae57d2ef9c52572f9b4a361036691c35935e93b3489d0caf1e8
|
|
BLAKE2b-256 checksum How to use checksums |
29f6f287ef7a41946d5ce4ab57d49d56f40e66b5e298816b9f5d954744809d32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for ikc-video-sdk 0.1.1
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.