Skip to content

Commit c7ebec3

Browse files
committed
chore: prepare Python typecheck
1 parent 339cbe2 commit c7ebec3

212 files changed

Lines changed: 3897 additions & 4 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ jobs:
4646
node-version: ${{ matrix.node-version }}
4747
cache: pnpm
4848

49+
- uses: astral-sh/setup-uv@v5
50+
with:
51+
enable-cache: true
52+
4953
- name: Install dependencies
5054
run: pnpm install --frozen-lockfile
5155

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ yarn-error.log*
1414
dist
1515
coverage
1616
.env
17+
.venv
1718
.next
1819
.nuxt
1920
.output

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
"eslint.nodePath": "./node_modules",
1111
"eslint.workingDirectories": [{ "pattern": "./packages/*/" }],
1212
"oxc.fmt.configPath": ".oxfmtrc.json",
13+
"search.exclude": {
14+
"**/*-lock.yaml": true,
15+
"**/*.log": true,
16+
"**/*.map": true,
17+
"**/*.mjs": true,
18+
"**/*.mts": true,
19+
"**/*.tsbuildinfo": true
20+
},
1321
"typescript.preferences.autoImportFileExcludePatterns": ["dist/**"],
1422
"typescript.preferences.autoImportSpecifierExcludeRegexes": ["^(node:)?os$"],
1523
"typescript.tsdk": "node_modules/typescript/lib",

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
"examples:check": "sh ./scripts/examples-check.sh",
2626
"examples:generate": "sh ./scripts/examples-generate.sh",
2727
"format": "oxfmt .",
28-
"lint:fix": "oxfmt . && eslint . --fix",
28+
"format:next": "oxfmt . && uv run ruff format packages/openapi-python/src/ts-python/__snapshots__",
2929
"lint": "oxfmt --check . && eslint .",
30+
"lint:next": "oxfmt --check . && eslint . && uv run ruff check packages/openapi-python/src/ts-python/__snapshots__",
31+
"lint:fix": "oxfmt . && eslint . --fix",
32+
"lint:fix:next": "oxfmt . && eslint . --fix && uv run ruff check --fix packages/openapi-python/src/ts-python/__snapshots__",
3033
"prepare": "husky",
3134
"test:changelog": "vitest run __tests__/*.test.ts",
3235
"test:changelog:watch": "vitest watch __tests__/*.test.ts",
@@ -39,6 +42,7 @@
3942
"tw": "turbo run test:watch --filter",
4043
"tu": "turbo run test:update --filter",
4144
"tb": "turbo run build --filter",
45+
"ty": "turbo run typecheck --filter",
4246
"dev:ts": "cd dev && tsx watch --clear-screen=false ../packages/openapi-ts/src/run.ts",
4347
"dev:py": "cd dev && tsx watch --clear-screen=false ../packages/openapi-python/src/run.ts"
4448
},
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
node "%~dp0\run.js" %*
3+

packages/openapi-python/bin/run.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env node
2+
import { spawnSync } from 'node:child_process';
3+
import fs from 'node:fs';
4+
import path from 'node:path';
5+
import { fileURLToPath } from 'node:url';
6+
7+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
8+
const target = path.join(__dirname, '..', 'dist', 'run.mjs');
9+
10+
if (!fs.existsSync(target)) {
11+
console.error('openapi-python not built (expect dist/run.mjs)');
12+
process.exit(1);
13+
}
14+
15+
const res = spawnSync(process.execPath, [target, ...process.argv.slice(2)], {
16+
stdio: 'inherit',
17+
});
18+
process.exit(res.status ?? 0);

packages/openapi-python/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"test:update": "vitest watch --update",
6161
"test:watch": "vitest watch",
6262
"test": "vitest run",
63-
"typecheck": "tsc --noEmit"
63+
"typecheck": "tsc --noEmit",
64+
"typecheck:next": "tsc --noEmit && uv run mypy src/ts-python/__snapshots__"
6465
},
6566
"dependencies": {
6667
"@hey-api/codegen-core": "workspace:*",

packages/openapi-python/src/createClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import colors from 'ansi-colors';
2121
import { postProcessors } from './config/output/postprocess';
2222
import type { Config } from './config/types';
2323
import { generateOutput } from './generate/output';
24-
// import { TypeScriptRenderer } from './ts-dsl';
24+
// import { TypeScriptRenderer } from './py-dsl';
2525

2626
export async function createClient({
2727
config,

packages/openapi-python/src/plugins/@hey-api/sdk/v1/plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ import type { HeyApiSdkPlugin } from '../types';
22

33
export const handlerV1: HeyApiSdkPlugin['Handler'] = ({ plugin }) => {
44
console.log(plugin);
5+
// plugin.node()
56
};

packages/openapi-python/src/py-dsl/index.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)