Skip to content

fix(python): install pylsp outside project workspaces#201

Open
March-77 wants to merge 1 commit into
cloudwego:mainfrom
March-77:agent/cache-pylsp-install
Open

fix(python): install pylsp outside project workspaces#201
March-77 wants to merge 1 commit into
cloudwego:mainfrom
March-77:agent/cache-pylsp-install

Conversation

@March-77

Copy link
Copy Markdown

What type of PR is this?

fix

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • No user-documentation update is required; this restores the intended automatic installer behavior.

(Optional) Translate the PR title into Chinese.

fix(python): 在项目工作区之外安装 pylsp

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:

The Python language-server installer previously cloned its pylsp fork into the current working directory. That polluted the project being parsed and introduced another pyproject.toml, while PythonSpec.WorkSpace panicked as soon as it saw more than one.

This change:

  • installs and reuses pylsp under os.UserCacheDir()/abcoder/pylsp;
  • clones into a unique temporary cache directory, validates the checkout, and atomically publishes it so concurrent or interrupted installs cannot expose a partial checkout;
  • removes the unused pyproject.toml counting walk, which never contributed to module discovery and only caused the panic;
  • adds cache-path, reuse, concurrent-install, interrupted-clone, nested-project, and missing-root regression tests.

Validation:

  • go test ./lang/python -count=20
  • go test -race ./lang/python -count=1
  • go vet ./lang/python
  • golangci-lint run --new-from-rev=origin/main ./lang/python

The repository-wide CI-equivalent command was also attempted locally. Python and most packages passed; the remaining failures were Windows environment/toolchain issues in Rust/rust-analyzer and gopls path handling, outside this change. The repository CI runs these checks on Ubuntu.

zh(optional):

pylsp 现在安装到用户缓存目录;临时 clone 完成并校验后再原子发布,避免并发或中断安装留下半成品。Python workspace 不再因嵌套 pyproject.toml 崩溃。

(Optional) Which issue(s) this PR fixes:

Fixes #185

(optional) The PR that updates user documentation:

N/A

@CLAassistant

CLAassistant commented Jul 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@March-77
March-77 marked this pull request as ready for review July 23, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

parse python clones pylsp fork into project root, then panics with "multiple pyproject.toml files found"

2 participants