feat: 支持 uv 从 pyproject/requirements 创建虚拟环境
- 工作目录探测新增 pyproject.toml / requirements*.txt 扫描、uv 可用性与 can_create - 新增 POST /api/v1/python/venv/create:已有虚拟环境优先复用;pyproject 走 uv sync,requirements 走 uv venv + uv pip install,并使用默认 PyPI 镜像 - 编辑器在缺少虚拟环境且具备依赖文件时显示「用 uv 创建环境」;没有 uv 或没有依赖文件时明确报错 - 解释器字段改为可选,留空由服务端默认 python.exe 并使用虚拟环境;Python 任务缺少虚拟环境/依赖文件时运行直接失败,不再回退系统解释器 - 补后端探测/创建测试、前端入口测试与 README
This commit is contained in:
@@ -116,6 +116,22 @@ export interface paths {
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/python/venv/create": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
put?: never;
|
||||
post: operations["create_python_venv"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/api/v1/runs/{run_id}": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
@@ -352,6 +368,10 @@ export interface components {
|
||||
name: string;
|
||||
trusted_host?: string | null;
|
||||
};
|
||||
/** @description 用 uv 为项目创建 `.venv`(pyproject 用 uv sync,requirements 用 uv venv + uv pip install)。 */
|
||||
CreatePythonVenvRequest: {
|
||||
working_dir: string;
|
||||
};
|
||||
CreateTaskRequest: {
|
||||
action: components["schemas"]["TaskAction"];
|
||||
concurrency_policy?: components["schemas"]["ConcurrencyPolicy"];
|
||||
@@ -598,12 +618,22 @@ export interface components {
|
||||
working_dir: string;
|
||||
};
|
||||
VenvProbeResponse: {
|
||||
/** @description 没有虚拟环境时,是否具备用 uv 创建的条件 */
|
||||
can_create: boolean;
|
||||
/** @description 供界面展示的解释器路径;位于工作目录内时使用相对路径 */
|
||||
display_path?: string | null;
|
||||
/** @description 工作目录根部是否存在 pyproject.toml */
|
||||
has_pyproject: boolean;
|
||||
/** @description 工作目录根部是否存在 requirements*.txt */
|
||||
has_requirements: boolean;
|
||||
interpreter_kind: components["schemas"]["InterpreterKind"];
|
||||
message: string;
|
||||
/** @description 探测到的 requirements 文件名(仅根目录) */
|
||||
requirements_files: string[];
|
||||
source?: components["schemas"]["VenvSource"] | null;
|
||||
status: components["schemas"]["VenvProbeStatus"];
|
||||
/** @description 本机 PATH 中是否能找到 uv */
|
||||
uv_available: boolean;
|
||||
/** @description 虚拟环境根目录的绝对路径 */
|
||||
venv_path?: string | null;
|
||||
};
|
||||
@@ -939,6 +969,39 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
create_python_venv: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["CreatePythonVenvRequest"];
|
||||
};
|
||||
};
|
||||
responses: {
|
||||
/** @description Created or reused project virtual environment */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["VenvProbeResponse"];
|
||||
};
|
||||
};
|
||||
/** @description Project cannot create a virtual environment */
|
||||
400: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ErrorResponse"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
get_run: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
|
||||
Reference in New Issue
Block a user