feat(python): install packages from version control or a local directory (#6601)

A + button in the Python Packages tool window offers Install from Version Control… and Install from Disk… (with Browse), both with Install as editable (-e). A plain https://, ssh://, git:// or git@host:path URL gets pip's git+ form; git+… and other vcs+ URLs pass as they are. sdk_python_pip takes an editable flag that adds -e (pip and uv pip); text starting with - is still refused, so no other pip option can be passed.

Closes #6531

Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
LU XIANGRUIтаwildcatDownstairs authored and GitHub committed 2026-11-28 08:37:01 +08:00
1 джерело 3747a8a63f
коміт ddea7e5ec5
15 files changed
+237 -14

No files matched your search

+11
Переглянути файл
@@ -56,3 +56,14 @@ export function listRows(
/** `name==version`, or the bare name for the newest release. */
export const requirementOf = (name: string, version: string | null) => (version ? `${name}==${version}` : name);
/**
* What pip installs for a repository URL: `git+https://…` and other `vcs+` forms as they are, a
* plain `https://`, `ssh://` or `git://` URL and scp-like `git@host:path` as Git.
*/
export function vcsRequirement(url: string) {
const text = url.trim();
if (/^(https?|ssh|git):\/\//i.test(text)) return `git+${text}`;
const scp = /^([\w.-]+@[\w.-]+):(?!\/\/)(.+)$/.exec(text);
return scp ? `git+ssh://${scp[1]}/${scp[2]}` : text;
}