Skip to content

Raise a helpful error for VCS URLs in install() - #277

Merged
ryanking13 merged 1 commit into
pyodide:mainfrom
SAY-5:feat/helpful-vcs-error
May 20, 2026
Merged

Raise a helpful error for VCS URLs in install()#277
ryanking13 merged 1 commit into
pyodide:mainfrom
SAY-5:feat/helpful-vcs-error

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 19, 2026

Copy link
Copy Markdown
Contributor

Closes #77. When install receives a VCS URL (git+, hg+, svn+, bzr+) it now raises a ValueError that explains micropip only installs prebuilt wheels, instead of the opaque packaging parser stack trace shown in the issue. @ryanking13 said "Sure, PR welcome" to improving that message. Includes a parametrized test covering the four VCS prefixes and a CHANGELOG entry.

Comment thread CHANGELOG.md
- `install` now raises a helpful `ValueError` when given a VCS URL
(`git+`, `hg+`, `svn+`, `bzr+`) instead of an opaque parser error,
explaining that micropip only installs prebuilt wheels.
[#77](https://github.com/pyodide/micropip/issues/77)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[#77](https://github.com/pyodide/micropip/issues/77)
[#277](https://github.com/pyodide/micropip/pull/277)

@ryanking13 ryanking13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks!

@ryanking13
ryanking13 merged commit 103c6fe into pyodide:main May 20, 2026
7 checks passed
Comment thread micropip/transaction.py
Comment on lines +86 to +92
if isinstance(req, str) and _looks_like_vcs_url(req):
raise ValueError(
f"Cannot install {req!r}: micropip only installs prebuilt wheels "
"and does not support installing from a VCS URL "
"(git+, hg+, svn+, bzr+). Provide a wheel URL or a package name "
"available on a configured index."
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if isinstance(req, str) and _looks_like_vcs_url(req):
raise ValueError(
f"Cannot install {req!r}: micropip only installs prebuilt wheels "
"and does not support installing from a VCS URL "
"(git+, hg+, svn+, bzr+). Provide a wheel URL or a package name "
"available on a configured index."
)
if isinstance(req, str) and _looks_like_vcs_url(req):
raise ValueError(
f"Cannot install {req!r}: micropip only installs prebuilt wheels "
"and does not support installing from a VCS URL "
"(git+, hg+, svn+, bzr+). Provide a URL pointing to a wheel "
"or a package name available on a configured index."
)

(nit: sorry, I know) – I think this would be a bit cleaner!

@ryanking13

Copy link
Copy Markdown
Member

Oh maybe I clicked the merge button too soon 😅

@agriyakhetarpal

Copy link
Copy Markdown
Member

Oops!

@ryanking13

Copy link
Copy Markdown
Member

@copilot open A PR that addresses comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a more helpful error message when attempting to VCS-install a package

3 participants