dhi-python

用 Python 的 BaseModel 接口定义数据模型并校验输入。项目采用 Zig 原生实现,接口参照 Pydantic v2。

仓库最近推送
Stars
390
Forks
7
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "dhi-python":https://skillpi.com/zh/skills/deepskill-d1843d29c9b89b3d604f44fc24b439b7b3ad799a22705960da262c00fb9c8f8a。安装前核对上游来源和版本:https://github.com/justrach/dhi。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

完整包尚未通过归档与安全核验。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

用 Python 的 BaseModel 接口定义数据模型并校验输入。项目采用 Zig 原生实现,接口参照 Pydantic v2。

0 下载 0 分享点击

介绍来源: third_party · justrach · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
输入和输出
来源文档未说明。
软件、账号及付费要求
来源文档未说明。
限制与区别
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

本站暂无可核验的版本文件清单。

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗

本站暂未展示原始 SKILL.md。 查看原始来源 ↗ 文件内容、许可与使用要求以原站为准。

版本历史

  1. v1.7.0 GitHub ↗
    原版更新说明

    Codecs, real async parsing, and the remaining Zod 4 API surface. Published to npm with SLSA provenance via an OIDC trusted publisher. ## Added - **Codecs** — `z.codec(input, output, { decode, encode })` plus `z.encode`/`decode`/ `safeEncode`/`safeDecode` (and `*Async`) and matching methods on every schema. Encoding runs the schema backwards through codecs, pipes and `z.stringbool()`, and refuses one-way `.transform()`s with a `ZodEncodeError`. - **Real async parsing** — `.parseAsync()` / `.safeParseAsync()` / `.spa()` await async refinements, superRefinements, transforms and `.check()` callbacks, including when nested in objects, arrays, tuples, records, sets, maps, unions and wrappers. A synchronous `.parse()` that meets one throws `ZodAsyncError` instead of leaking a Promise. - **Error helpers** — `z.treeifyError()`, `z.flattenError()`, `z.formatError()`, all with the optional issue mapper. `ZodError` is now an `Error` with a lazily built `.stack` and gains `.isEmpty`, `.addIssue()`, `.addIssues()`. - **Top-level functional API** — `z.parse`/`safeParse`/`parseAsync`/`safeParseAsync`, `z.transform`, `z.catch`, `z.default`, `z.prefault`, `z.nullish`, `z.nonoptional`, `z.readonly`, `z.exactOptional`, `z.keyof`, `z.clone`, `z.xor`, `z.stringFormat`, `z.slugify`, `z.describe`, `z.meta`, `z.fromJSONSchema`. - **Constants and namespaces** — `z.NEVER`, `z.TimePrecision`, `z.ZodIssueCode`, `z.$brand`, `z.regexes`, `z.util`, `z.core`, `z.locales`, `z.config()`, `z.getErrorMap()`, `z.setErrorMap()`, and runtime `z.ZodString` / `z.ZodObject` / … class aliases. - **Schema introspection** — `.type`, `.apply()`, `.with()`, `.toJSONSchema()`, `.spa()` on every schema, plus `.format`/`.minValue`/`.maxValue`/`.isInt` on numbers, `.minDate`/ `.maxDate` on dates, `.element` on arrays, `.keyType`/`.valueType` on records and maps. - `z.object().safeExtend()`, `z.tuple(items, rest)`, `z.map().min/max/size/nonempty()`, `z.function().implementAsync()`, `z.string().slugify()`. - `z.toJSONSchema()` accepts `target`, `metadata`, `unrepresentable`, `override` and `io`, and emits Zod's document shape. `.meta()` registers in `z.globalRegistry`. ## Changed - Issues carry Zod 4 codes natively (`invalid_format`, `invalid_value`, `invalid_union`); Zod 3 spellings passed to `ctx.addIssue()` are still accepted and normalised. - `.prefault(v)` runs the fallback through the schema; `.default(v)` still short-circuits. - `.transform()` receives Zod's `ctx`; `.catch()` receives `{ value, issues, error, input }`; `.refine()` accepts `{ when, abort, path, message, error }`. - `z.prettifyError()` uses Zod's layout; `error.flatten()` keys `fieldErrors` like Zod. - `.extend()`, `.pick()`, `.omit()`, `.partial()`, `.required()` keep the object's unknown-key policy. - `z.discriminatedUnion()` resolves discriminators through optional, nullable, enum and nested-union options. ## Performance Zig core JSON parse/validate paths use a stack-owned arena instead of a heap-allocated `Parsed` wrapper, and `json_batch_validator` is now part of `zig build test`. (#80) The differential parity suite is now 283 schemas / 4,961 checks against `[email protected]` with zero mismatches, and dhi remains faster than Zod on every benchmark row.

  2. v1.6.0 GitHub ↗
    原版更新说明

    Zod 4 core compatibility, one runtime-agnostic core, and Windows wheels. ## Zod 4 core internals (#76) Every dhi schema now exposes Zod 4's internals (`_zod.def`, `_zod.run`, `optin`/`optout`, `values`, the JSON-Schema hook) and is assignable to Zod's `$ZodType` at the type level. Libraries that detect Zod 4 schemas and call Zod's own core helpers work unchanged: - `@modelcontextprotocol/sdk` `registerTool` / `registerPrompt` — object schemas, raw shapes and output schemas. `tools/list` no longer fails with `def.shape is not a function`. - `z.toJSONSchema(dhiSchema)`, `z.safeParse(dhiSchema, …)`, `instanceof z.ZodObject`. ## Single runtime-agnostic core `dhi`, `dhi/edge`, `dhi/cloudflare` and `dhi/nextjs` now re-export the same core: identical behaviour and JIT everywhere, no WASM instantiation, no top-level await, no bundler configuration. The edge and Next.js entries had drifted ~800 lines behind the Node entry. ## Behavioural parity with Zod 4 A new differential test (`tests/test-zod-parity.ts`) runs 250+ schemas over 4,400+ inputs against the real `zod` package and requires identical accept/reject decisions and identical parsed output. Closing the gaps it found changed, among others: - String formats: `uuid` checks RFC 9562 version/variant nibbles, `url` accepts any WHATWG-parsable URL, `ipv6`/`cidrv6` use the WHATWG parser, `base64`/`base64url` padding rules, leap-year-aware `date`, ISO 8601-1 `duration`, Zod's `email` rules. - `.lowercase()` / `.uppercase()` validate case (`.toLowerCase()` / `.toUpperCase()` transform). - `z.number()` rejects `Infinity`; `.int()` means safe integer; float-safe `.multipleOf()`. - Objects: absent optional keys stay absent, `.catchall()` validates unknown keys, JSON Schema `required` follows Zod's `optin`/`optout` rule with `io: 'input' | 'output'` honoured. - Tuples allow omitting trailing optional items; enum-keyed records are exhaustive (`z.partialRecord` for optional keys); `z.coerce.date()` coerces any input. ## Also added - Zod 4 standalone checks for `.check(...)`: `z.minLength`, `z.gt`/`gte`/`lt`/`lte`, `z.multipleOf`, `z.regex`, `z.refine`, `z.superRefine` and the rest of the set. - `z.uuidv4/v6/v7`, `z.xid`, `z.ksuid`, `z.hash()`, `z.httpUrl()`, `z.hostname()`, `z.hex()`, `z.stringbool()`, `z.iso.datetime()`, `z.mac()`, `z.jwt()`. - `.nonoptional()` and `.exactOptional()` as real wrappers. - `z.enum([...])` infers the literal union instead of widening to `string`. - `dhi/schema-nextjs` export alias. ## Python Windows wheels (AMD64, CPython 3.9–3.14 including free-threaded) are now built and published; the C extension compiles under MSVC. (#59)

  3. v1.5.2 GitHub ↗
    原版更新说明

    ## dhi v1.5.2 **Ultra-fast Zod 4 drop-in replacement — SIMD-powered WASM + N-API native addon** ### Performance (vs Zod 4.3.6) - String validators: 1.1–2.9x faster - Number validators: up to 48x faster - Object validators: 4–7x faster (JIT-compiled) - Coercion: 25–47x faster - Zero production dependencies ### Features - Full Zod 4 API parity (drop-in replacement) - Complete TypeScript type inference - SIMD-powered WASM validators (28KB binary) - JIT-compiled object schemas - All string/number/object/array/union/enum validators ### Installation ```bash npm install [email protected] ``` ### Migration from Zod ```typescript // Before import { z } from 'zod'; // After import { z } from 'dhi'; // That's it — same API, faster runtime ```

  4. v1.5.0 GitHub ↗
    原版更新说明

    ## dhi v1.5.0 **Ultra-fast Zod 4 drop-in replacement — SIMD-powered WASM + N-API native addon** ### Performance (vs Zod 4.3.6) - String validators: 1.1–2.9x faster - Number validators: up to 48x faster - Object validators: 4–7x faster (JIT-compiled) - Coercion: 25–47x faster - Zero production dependencies ### Features - Full Zod 4 API parity (drop-in replacement) - Complete TypeScript type inference - SIMD-powered WASM validators (28KB binary) - JIT-compiled object schemas - All string/number/object/array/union/enum validators ### Installation ```bash npm install [email protected] ``` ### Migration from Zod ```typescript // Before import { z } from 'zod'; // After import { z } from 'dhi'; // That's it — same API, faster runtime ```

  5. v1.4.1 GitHub ↗
    原版更新说明

    ## dhi v1.4.1 **Ultra-fast Zod 4 drop-in replacement — SIMD-powered WASM + N-API native addon** ### Performance (vs Zod 4.3.6) - String validators: 1.1–2.9x faster - Number validators: up to 48x faster - Object validators: 4–7x faster (JIT-compiled) - Coercion: 25–47x faster - Zero production dependencies ### Features - Full Zod 4 API parity (drop-in replacement) - Complete TypeScript type inference - SIMD-powered WASM validators (28KB binary) - JIT-compiled object schemas - All string/number/object/array/union/enum validators ### Installation ```bash npm install [email protected] ``` ### Migration from Zod ```typescript // Before import { z } from 'zod'; // After import { z } from 'dhi'; // That's it — same API, faster runtime ```

此处仅展示最近 5 个版本。 在原站查看完整版本历史 ↗

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值78/100

亮点

  • 提供高性能数据验证库的完整使用指南,适用于API开发和配置验证等实际场景
  • 详细说明了与Pydantic的兼容性,便于用户迁移
触发精准85/100

亮点

  • 触发描述清晰准确,涵盖了主要使用场景和技术特性
结构规范92/100

亮点

  • 文档结构完整,章节划分清晰,包含丰富的代码示例和性能对比数据
执行可靠88/100

亮点

  • 提供了正确的安装命令和全面的API使用示例,执行风险低
证据可验 (前四项均值)86/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

暂无正文检测结果。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

主文档不可用或超出检查范围,权限尚不能确认。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

risk · 静态证据核验,不代表运行安全保证。

来源文档未说明。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。