Skip to main content

gherkai-core

gherkai 的执行核心库:把 .feature 解析成领域模型 → 按 tag 分组成可并发的 job → 并发调度 → 收集成结构化结果。 核心逻辑不带任何 AI 引擎依赖、不碰文件系统、也不 import boto3——AI 引擎跑在被 spawn 的 worker 子进程里、讲一套 JSON 协议,落盘/云服务/起进程都在你注入的接口实现里(本包顺带提供了几个现成实现,见下)。想直接跑测试的人要的是命令行工具 gherkai;本包是给要把这套执行模型嵌进自己程序 (WebUI、调度服务、CI 插件)的人。

安装

uv add gherkai-core            # 或 pip install gherkai-core
uv add 'gherkai-core[aws]'     # 顺带 DynamoDB / S3 那组实现(拉 boto3)

需要 Python ≥ 3.13。装了 gherkai 命令行的人不用单独装它。

最小用法

from gherkai_core.model import RunMeta
from gherkai_core.schedule import ScheduleOpts, schedule
from gherkai_core.scope import FeatureSource, PlanConfig, plan

jobs = plan(
    [FeatureSource(uri="checkout.feature", text=feature_text)],   # 内容,不是路径
    PlanConfig(default_engine="novaact", default_job_timeout_s=300),
)
meta = RunMeta(run_id="r-1", created_at="2026-01-01T00:00:00Z", jobs=tuple(jobs), max_concurrency=2)
result = schedule(meta, engine_resolver, progress_sink, ScheduleOpts(max_concurrency=2))
print(result.status)          # passed / failed / error / …
  • plan(features, config) 按 @scope / @engine / @timeout: tag 分组、校验冲突,产出 Job[]。
  • schedule(...) 同步跑完一批:并发上限、失败隔离、墙钟超时、优雅停都在里面。RunResult 是四层结构 (run → job → scenario → step),每层带判定与时长。
  • 想要「提交完就走、谁来查谁接力」那种跑法,用 reconcile.tick(...):它从一条持久事件流重放推演出下一步动作, 可以由任何宿主(后台进程、云函数、下一次查询)反复调用而不重复起 job。

你要注入什么(gherkai_core.ports)

接口 你提供
Engine / WorkerHandle / EngineResolver 怎么起一个引擎 worker、怎么读它的事件流、怎么停它
Sink / JobSink 进度事件、每个 job 完成时的判定结果回调(进度显示、实时落库)
RunStore / ResultStore / ReportStore 运行状态、判定真值、报告分别落在哪

gherkai_core.adapters 里已有一组现成实现:本机子进程引擎 / Fargate 引擎、本地文件 store / DynamoDB + S3 store、 SQLite / DynamoDB 事件流。不想自己接线就用 gherkai-runtime, 它把这些组装好了(命令行工具用的就是它)。

异常

异常 什么时候
errors.PlanError feature 写法或配置违约(同一个 scope 标了多个引擎、uri 冲突…)——在起任何 job 之前抛
errors.WorkerNetworkError 引擎 worker 报的网络类故障,已归好类,由你决定要不要重试
parse.FeatureParseError Gherkin 语法错

判定态是 model.Status:worker 只报 passed / failed / error,skipped / aborted 是快速失败下的派生终态, pending / running 只出现在运行中的状态视图里、不会成为终态判定。

相关

主页与问题反馈:https://github.com/zhiyanliu/gherkai#readme | https://github.com/zhiyanliu/gherkai/issues

设计文档(架构决策记录)见 https://github.com/zhiyanliu/gherkai/tree/HEAD/docs/adr

Metadata

Release files for gherkai-core 1.4.1

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

Source distribution (sdist)

Source distribution for gherkai-core 1.4.1
File Size Uploaded
gherkai_core-1.4.1.tar.gz 200.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gherkai-core 1.4.1
File Interpreter ABI Platform
gherkai_core-1.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 328.5 kB

Release files / gherkai_core-1.4.1.tar.gz

Download URL gherkai_core-1.4.1.tar.gz
Size 200.8 kB
Tags Source
SHA-256 checksum
How to use checksums
42ae40de66a6e1fe58f6316dd65dd16cacd1c572d5a6ba72e7bcadb28938a736
BLAKE2b-256 checksum
How to use checksums
70888d6801a68cd782f1f8c5f6ffbf429dde507d49c329652b2ae08e1729de40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.

Transparency log

Release files / gherkai_core-1.4.1-py3-none-any.whl

Download URL gherkai_core-1.4.1-py3-none-any.whl
Size 127.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c86866d25bc122650d6a6ebd66ee1a4c9cbd367237c2bdc3a1657a436398e33
BLAKE2b-256 checksum
How to use checksums
50d8b5943b76f68cd863901597d2775a10a48c4670849333b3b252ff93a87c25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.

Transparency log

Release history Release notifications | RSS feed

1.4.9

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

This release

1.4.1 This release

2 release files

1.4.0

2 release files

0.0.0

2 release files

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