Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit error message for URLs without package names #669

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

charliermarsh
Copy link
Member

pip supports installing packages without names (e.g., git+https://github.com/pallets/flask.git), but it doesn't adhere to the PEP grammar, and we don't yet support it (and may never) (#313).

This PR adds a dedicated error path for such cases, to ensure that we can give meaningful feedback to the user:

error: Couldn't parse requirement in requirements.in position 0 to 18
  Caused by: URL requirement is missing a package name; expected: `package_name @ https://google.com`
https://google.com
^^^^^^^^^^^^^^^^^^

Closes #650.

@charliermarsh charliermarsh added the error messages Messaging when something goes wrong label Dec 16, 2023
@charliermarsh charliermarsh enabled auto-merge (squash) December 16, 2023 21:11
@charliermarsh charliermarsh merged commit f62458f into main Dec 16, 2023
3 checks passed
@charliermarsh charliermarsh deleted the charlie/url-error branch December 16, 2023 21:14
charliermarsh added a commit that referenced this pull request Mar 11, 2024
…ts (#2369)

## Summary

This is analogous to #669, but for cases in which the package name is a
filesystem path. In such cases, we'll fail when parsing the _package
name_, since it doesn't start with a valid character, as opposed to
failing when we go to parse the remaining version specifier.

Inspired by #2356.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Messaging when something goes wrong
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add custom error messages for package name-less requirements
1 participant