feat: 支持 Python venv 隔离环境,适配 Node.js 原生部署#3009
Open
jiandanc wants to merge 1 commit into
Open
Conversation
## 背景 原方案使用系统 Python + pip --prefix 安装依赖到 data/dep_cache/python3, 系统 Python 环境被污染,且无法隔离不同项目的依赖。 ## 改动内容 ### 核心:Python venv 支持 - shell/start.sh: 使用 python3 -m venv 创建虚拟环境,替代 --prefix 模式 - 从 .env 文件读取 PYTHON_VENV_DIR 配置 - 首次启动自动创建 .venv,已存在则跳过 - 仅将 .venv/bin 加入 PATH 优先级,不设置 PYTHONHOME/PYTHONPATH(避免破坏 venv 机制) - .env 不再强制覆盖,仅首次从 .env.example 复制 - 启动时自动修复 task/ql 软链接指向当前部署目录 ### 后端适配 - back/config/const.ts: 新增 PYTHON_VENV_DIR 常量 - back/config/util.ts: venv 模式下跳过 pip --prefix,直接使用 venv 的 pip3 ### 开发模式支持 - shell/dev-env.sh: pnpm start 时自动 source,将 .venv/bin 加入 PATH - package.json: start:back 加入 source dev-env.sh ### 新增文件 - shell/start-simplify.sh: 精简版启动脚本(跳过系统依赖安装,适用于已预装环境的服务器) - README-NODE.md: Node.js 原生部署完整文档 ### 配置 - .env.example: 新增 PYTHON_VENV_DIR=./.venv 配置项(默认注释状态) ## 兼容性 - Docker 模式不受影响(使用独立的 docker-entrypoint.sh,走原有 --prefix 逻辑) - 未配置 PYTHON_VENV_DIR 时默认使用系统 Python(向后兼容)
|
@jiandanc is attempting to deploy a commit to the hunter wang's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
|
nodejs 原生部署用 npm i @whyour/qinglong 是不是可以 |
23124c2 to
b5a5fb3
Compare
Author
可以的,主要问题是qinglong nom安装默认是使用的系统的python环境,可能会污染环境和存在包冲突 |
Owner
那我理解可以改下,
|
0aaaee2 to
2f7b6e3
Compare
953b68f to
f09ef37
Compare
39058bb to
23a1835
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
原方案使用系统 Python + pip --prefix 安装依赖到 data/dep_cache/python3, 系统 Python 环境被污染,且无法隔离不同项目的依赖。
改动内容
核心:Python venv 支持
后端适配
开发模式支持
新增文件
配置
兼容性
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information