Skip to content

Commit 32109a0

Browse files
committed
feat: add trust host option, fix race condition
1 parent e8f8f17 commit 32109a0

6 files changed

Lines changed: 582 additions & 110 deletions

File tree

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,6 @@ PLUGIN_RUNTIME_MAX_BUFFER_SIZE=5242880
188188
DIFY_BACKWARDS_INVOCATION_WRITE_TIMEOUT=5000
189189
# dify backwards invocation read timeout in milliseconds
190190
DIFY_BACKWARDS_INVOCATION_READ_TIMEOUT=240000
191+
192+
PIP_MIRROR_URL=
193+
PIP_EXTRA_INDEX_URL=

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,28 @@ Daemon uses `uv` to manage the dependencies of plugins, before you start the dae
6262
#### Interpreter
6363
There is a possibility that you have multiple python versions installed on your machine, a variable `PYTHON_INTERPRETER_PATH` is provided to specify the python interpreter path for you.
6464

65+
#### Speeding up Python dependency installation (uv/pip)
66+
You can speed up plugin dependency installation by configuring Python package indexes via environment variables (set them in your shell or `.env`). The daemon reads these into its config on startup.
67+
68+
Supported variables
69+
- PIP_MIRROR_URL: Primary index for both uv sync and uv pip install
70+
- PIP_EXTRA_INDEX_URL: One or more extra indexes (comma or space separated)
71+
72+
Behavior
73+
- Applies uniformly to both dependency styles:
74+
- pyproject.toml (using `uv sync`)
75+
- requirements.txt (using `uv pip install`)
76+
- Trusted hosts are derived automatically from the configured URLs.
77+
78+
Examples
79+
```bash
80+
# Use the official PyPI index
81+
PIP_MIRROR_URL=https://pypi.org/simple
82+
83+
# Add multiple mirrors (comma or space separated)
84+
PIP_EXTRA_INDEX_URL="https://my.mirror/simple, https://another.mirror/simple"
85+
```
86+
6587
## Deployment
6688

6789
Currently, the daemon only supports Linux and MacOS, lots of adaptions are needed for Windows, feel free to contribute if you need it.

internal/core/local_runtime/dependency_installation_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ func TestPreparePipArgs(t *testing.T) {
200200
"pip",
201201
"install",
202202
"-i", "https://pypi.tuna.tsinghua.edu.cn/simple",
203+
"--trusted-host", "pypi.tuna.tsinghua.edu.cn",
203204
"-r", "requirements.txt",
204205
}, args)
205206
})
@@ -229,6 +230,7 @@ func TestPreparePipArgs(t *testing.T) {
229230
"pip",
230231
"install",
231232
"-i", "https://pypi.tuna.tsinghua.edu.cn/simple",
233+
"--trusted-host", "pypi.tuna.tsinghua.edu.cn",
232234
"-r", "requirements.txt",
233235
"-vvv",
234236
"--no-cache",

0 commit comments

Comments
 (0)