@contractkit/plugin-python
Advanced tools
| > @contractkit/plugin-python@0.10.1 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-python | ||
| > @contractkit/plugin-python@0.11.0 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-python | ||
| > eslint --max-warnings=0 && pnpm run build | ||
| > @contractkit/plugin-python@0.10.1 build /home/runner/work/ContractKit/ContractKit/packages/plugin-python | ||
| > @contractkit/plugin-python@0.11.0 build /home/runner/work/ContractKit/ContractKit/packages/plugin-python | ||
| > tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration | ||
@@ -14,7 +14,7 @@ | ||
| [34mESM[39m Build start | ||
| [32mESM[39m [1mdist/index.js [22m[32m42.33 KB[39m | ||
| [32mESM[39m [1mdist/index.js.map [22m[32m89.19 KB[39m | ||
| [32mESM[39m ⚡️ Build success in 192ms | ||
| [32mESM[39m [1mdist/index.js [22m[32m42.68 KB[39m | ||
| [32mESM[39m [1mdist/index.js.map [22m[32m90.20 KB[39m | ||
| [32mESM[39m ⚡️ Build success in 156ms | ||
| [34mDTS[39m Build start | ||
| [32mDTS[39m ⚡️ Build success in 3797ms | ||
| [32mDTS[39m ⚡️ Build success in 4501ms | ||
| [32mDTS[39m [1mdist/index.d.ts [22m[32m1.10 KB[39m |
| > @contractkit/plugin-python@0.10.1 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-python | ||
| > @contractkit/plugin-python@0.11.0 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-python | ||
| > vitest run --coverage | ||
@@ -9,9 +9,9 @@ | ||
| [32m✓[39m tests/codegen-client.test.ts [2m([22m[2m27 tests[22m[2m)[22m[32m 94[2mms[22m[39m | ||
| [32m✓[39m tests/codegen-models.test.ts [2m([22m[2m32 tests[22m[2m)[22m[32m 116[2mms[22m[39m | ||
| [32m✓[39m tests/codegen-models.test.ts [2m([22m[2m32 tests[22m[2m)[22m[32m 118[2mms[22m[39m | ||
| [32m✓[39m tests/codegen-client.test.ts [2m([22m[2m27 tests[22m[2m)[22m[32m 107[2mms[22m[39m | ||
| [2m Test Files [22m [1m[32m2 passed[39m[22m[90m (2)[39m | ||
| [2m Tests [22m [1m[32m59 passed[39m[22m[90m (59)[39m | ||
| [2m Start at [22m 11:16:36 | ||
| [2m Duration [22m 5.14s[2m (transform 2.46s, setup 0ms, import 7.24s, tests 210ms, environment 0ms)[22m | ||
| [2m Start at [22m 11:38:17 | ||
| [2m Duration [22m 5.48s[2m (transform 2.53s, setup 0ms, import 7.86s, tests 225ms, environment 0ms)[22m | ||
@@ -18,0 +18,0 @@ [34m % [39m[2mCoverage report from [22m[33mv8[39m |
+15
-0
| # @contractkit/contractkit-plugin-python | ||
| ## 0.11.0 | ||
| ### Minor Changes | ||
| - 4ac6d4d: Move plugin incremental-build manifests under the CLI cache directory (default `.contractkit/cache/`, configurable via `config.cache.dir`). Bruno's `.contractkit-bruno-manifest.json` (in the bruno-collection dir), Python's `.contractkit-python-manifest.json` (in the python-sdk dir), and TypeScript's `.contractkit-typescript-manifest.json` (at rootDir) now all live as `bruno-manifest.json` / `python-manifest.json` / `typescript-manifest.json` under `ctx.cacheDir`, alongside the CLI's existing `build.json` and HTTP cache. Output dirs no longer contain build state. | ||
| `PluginContext` gains a `cacheDir: string` field. `runIncrementalCodegen` no longer takes a `manifestFilename` argument and no longer bundles the manifest into `filesToWrite` — the result's `manifest` is returned separately so plugins can persist it wherever they want. New helper `serializeIncrementalManifest(manifest)` produces the JSON form. | ||
| After upgrading, the old in-output manifests can be deleted manually (or with `--force`); plugins will simply do a full regen on the first run since they won't find a manifest at the new path. | ||
| ### Patch Changes | ||
| - Updated dependencies [4ac6d4d] | ||
| - @contractkit/core@0.16.0 | ||
| ## 0.10.1 | ||
@@ -4,0 +19,0 @@ |
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <coverage generated="1778152601456" clover="3.2.0"> | ||
| <project timestamp="1778152601456" name="All files"> | ||
| <coverage generated="1778153903219" clover="3.2.0"> | ||
| <project timestamp="1778153903219" name="All files"> | ||
| <metrics statements="538" coveredstatements="456" conditionals="416" coveredconditionals="320" methods="91" coveredmethods="78" elements="1045" coveredelements="854" complexity="0" loc="538" ncloc="538" packages="2" files="3" classes="3"/> | ||
@@ -5,0 +5,0 @@ <package name="src"> |
@@ -119,3 +119,3 @@ | ||
| <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> | ||
| at 2026-05-07T11:16:41.420Z | ||
| at 2026-05-07T11:38:23.142Z | ||
| </div> | ||
@@ -122,0 +122,0 @@ <script src="prettify.js"></script> |
@@ -1348,3 +1348,3 @@ | ||
| <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> | ||
| at 2026-05-07T11:16:41.420Z | ||
| at 2026-05-07T11:38:23.142Z | ||
| </div> | ||
@@ -1351,0 +1351,0 @@ <script src="../prettify.js"></script> |
@@ -119,3 +119,3 @@ | ||
| <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> | ||
| at 2026-05-07T11:16:41.420Z | ||
| at 2026-05-07T11:38:23.142Z | ||
| </div> | ||
@@ -122,0 +122,0 @@ <script src="../prettify.js"></script> |
@@ -655,3 +655,3 @@ | ||
| <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> | ||
| at 2026-05-07T11:16:41.420Z | ||
| at 2026-05-07T11:38:23.142Z | ||
| </div> | ||
@@ -658,0 +658,0 @@ <script src="../prettify.js"></script> |
@@ -104,3 +104,3 @@ | ||
| <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> | ||
| at 2026-05-07T11:16:41.420Z | ||
| at 2026-05-07T11:38:23.142Z | ||
| </div> | ||
@@ -107,0 +107,0 @@ <script src="../prettify.js"></script> |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,iBAAiB,EAOpB,MAAM,mBAAmB,CAAC;AAmB3B,MAAM,WAAW,qBAAqB;IAClC,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAI1C,QAAA,MAAM,MAAM,EAAE,iBAMb,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAOvG"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,iBAAiB,EAOpB,MAAM,mBAAmB,CAAC;AAoB3B,MAAM,WAAW,qBAAqB;IAClC,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAK1C,QAAA,MAAM,MAAM,EAAE,iBAMb,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAOvG"} |
+18
-8
@@ -5,5 +5,5 @@ var __defProp = Object.defineProperty; | ||
| // src/index.ts | ||
| import { resolve, join, relative } from "path"; | ||
| import { existsSync, readFileSync, rmSync, readdirSync, rmdirSync } from "fs"; | ||
| import { runIncrementalCodegen, parseIncrementalManifest, emptyIncrementalManifest, hashFingerprint, collectTransitiveModelRefs, collectTypeRefs as collectTypeRefs2 } from "@contractkit/core"; | ||
| import { resolve, join, relative, dirname } from "path"; | ||
| import { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync, readdirSync, rmdirSync } from "fs"; | ||
| import { runIncrementalCodegen, parseIncrementalManifest, emptyIncrementalManifest, serializeIncrementalManifest, hashFingerprint, collectTransitiveModelRefs, collectTypeRefs as collectTypeRefs2 } from "@contractkit/core"; | ||
@@ -950,3 +950,3 @@ // src/codegen-models.ts | ||
| var PYTHON_CODEGEN_VERSION = "1"; | ||
| var MANIFEST_FILENAME = ".contractkit-python-manifest.json"; | ||
| var CACHE_MANIFEST_FILENAME = "python-manifest.json"; | ||
| var plugin = { | ||
@@ -973,2 +973,3 @@ name: "python-sdk", | ||
| const outDir = resolve(rootDir, config.baseDir ?? "python-sdk"); | ||
| const manifestPath = resolve(ctx.cacheDir, CACHE_MANIFEST_FILENAME); | ||
| const modelModulePaths = /* @__PURE__ */ new Map(); | ||
@@ -995,3 +996,3 @@ const modelMap = /* @__PURE__ */ new Map(); | ||
| ].sort(); | ||
| const prevManifest = ctx.cacheEnabled ? readManifest(outDir) : emptyIncrementalManifest(PYTHON_CODEGEN_VERSION); | ||
| const prevManifest = ctx.cacheEnabled ? readManifest(manifestPath) : emptyIncrementalManifest(PYTHON_CODEGEN_VERSION); | ||
| const units = []; | ||
@@ -1129,3 +1130,2 @@ for (const { moduleName, relPath, root } of contractEntries) { | ||
| codegenVersion: PYTHON_CODEGEN_VERSION, | ||
| manifestFilename: MANIFEST_FILENAME, | ||
| prevManifest, | ||
@@ -1140,2 +1140,3 @@ globalFiles, | ||
| } | ||
| writeManifest(manifestPath, result.manifest); | ||
| void relative; | ||
@@ -1193,4 +1194,3 @@ } | ||
| __name(paramSourceTypes, "paramSourceTypes"); | ||
| function readManifest(outDir) { | ||
| const manifestPath = resolve(outDir, MANIFEST_FILENAME); | ||
| function readManifest(manifestPath) { | ||
| if (!existsSync(manifestPath)) return emptyIncrementalManifest(PYTHON_CODEGEN_VERSION); | ||
@@ -1204,2 +1204,12 @@ try { | ||
| __name(readManifest, "readManifest"); | ||
| function writeManifest(manifestPath, manifest) { | ||
| try { | ||
| mkdirSync(dirname(manifestPath), { | ||
| recursive: true | ||
| }); | ||
| writeFileSync(manifestPath, serializeIncrementalManifest(manifest), "utf-8"); | ||
| } catch { | ||
| } | ||
| } | ||
| __name(writeManifest, "writeManifest"); | ||
| function deleteStalePaths(outDir, relPaths) { | ||
@@ -1206,0 +1216,0 @@ if (relPaths.length === 0) return; |
+4
-4
| { | ||
| "name": "@contractkit/plugin-python", | ||
| "version": "0.10.1", | ||
| "version": "0.11.0", | ||
| "description": "ContractKit built-in plugin: Python SDK client generation (Pydantic v2 + httpx)", | ||
@@ -29,3 +29,3 @@ "author": { | ||
| "dependencies": { | ||
| "@contractkit/core": "0.15.1" | ||
| "@contractkit/core": "0.16.0" | ||
| }, | ||
@@ -35,4 +35,4 @@ "devDependencies": { | ||
| "vitest": "^4.1.5", | ||
| "@repo/config-eslint": "0.3.1", | ||
| "@repo/config-typescript": "0.1.0" | ||
| "@repo/config-typescript": "0.1.0", | ||
| "@repo/config-eslint": "0.3.1" | ||
| }, | ||
@@ -39,0 +39,0 @@ "scripts": { |
+21
-8
@@ -1,3 +0,3 @@ | ||
| import { resolve, join, relative } from 'node:path'; | ||
| import { existsSync, readFileSync, rmSync, readdirSync, rmdirSync } from 'node:fs'; | ||
| import { resolve, join, relative, dirname } from 'node:path'; | ||
| import { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync, readdirSync, rmdirSync } from 'node:fs'; | ||
| import type { | ||
@@ -16,2 +16,3 @@ ContractKitPlugin, | ||
| emptyIncrementalManifest, | ||
| serializeIncrementalManifest, | ||
| hashFingerprint, | ||
@@ -52,3 +53,4 @@ collectTransitiveModelRefs, | ||
| const MANIFEST_FILENAME = '.contractkit-python-manifest.json'; | ||
| /** Filename for the persisted Python manifest under the CLI cache directory. */ | ||
| const CACHE_MANIFEST_FILENAME = 'python-manifest.json'; | ||
@@ -90,2 +92,3 @@ const plugin: ContractKitPlugin = { | ||
| const outDir = resolve(rootDir, config.baseDir ?? 'python-sdk'); | ||
| const manifestPath = resolve(ctx.cacheDir, CACHE_MANIFEST_FILENAME); | ||
@@ -113,3 +116,3 @@ // ── Build cross-file lookup tables ─────────────────────────────────────── | ||
| const prevManifest: IncrementalManifest = ctx.cacheEnabled ? readManifest(outDir) : emptyIncrementalManifest(PYTHON_CODEGEN_VERSION); | ||
| const prevManifest: IncrementalManifest = ctx.cacheEnabled ? readManifest(manifestPath) : emptyIncrementalManifest(PYTHON_CODEGEN_VERSION); | ||
| const units: IncrementalUnit[] = []; | ||
@@ -254,3 +257,2 @@ | ||
| codegenVersion: PYTHON_CODEGEN_VERSION, | ||
| manifestFilename: MANIFEST_FILENAME, | ||
| prevManifest, | ||
@@ -267,2 +269,4 @@ globalFiles, | ||
| } | ||
| writeManifest(manifestPath, result.manifest); | ||
| // Suppress unused import warning — `relative` is reserved for future use. | ||
@@ -320,5 +324,4 @@ void relative; | ||
| /** Read the previous run's manifest. Returns an empty manifest when missing or unreadable. */ | ||
| function readManifest(outDir: string): IncrementalManifest { | ||
| const manifestPath = resolve(outDir, MANIFEST_FILENAME); | ||
| /** Read the previous run's manifest from `manifestPath`. Returns an empty manifest when missing or unreadable. */ | ||
| function readManifest(manifestPath: string): IncrementalManifest { | ||
| if (!existsSync(manifestPath)) return emptyIncrementalManifest(PYTHON_CODEGEN_VERSION); | ||
@@ -332,2 +335,12 @@ try { | ||
| /** Write the manifest to `manifestPath`. Creates parent dirs as needed. Errors are swallowed so a broken cache never blocks the build. */ | ||
| function writeManifest(manifestPath: string, manifest: IncrementalManifest): void { | ||
| try { | ||
| mkdirSync(dirname(manifestPath), { recursive: true }); | ||
| writeFileSync(manifestPath, serializeIncrementalManifest(manifest), 'utf-8'); | ||
| } catch { | ||
| // best-effort | ||
| } | ||
| } | ||
| /** Delete paths from the prior manifest that aren't produced this run. Mirrors the Bruno cleanup approach. */ | ||
@@ -334,0 +347,0 @@ function deleteStalePaths(outDir: string, relPaths: string[]): void { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
667859
0.49%4499
0.47%+ Added
- Removed
Updated