-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
v2 - Catch problems with [tool.poetry.scripts] entries #8898
Merged
radoering
merged 9 commits into
python-poetry:master
from
sneakers-the-rat:script-error-msg
Feb 10, 2024
Merged
v2 - Catch problems with [tool.poetry.scripts] entries #8898
radoering
merged 9 commits into
python-poetry:master
from
sneakers-the-rat:script-error-msg
Feb 10, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 tasks
Secrus
previously requested changes
Jan 27, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small issue, other than that, LGTM.
Co-authored-by: Randy Döring <[email protected]>
… colons and too many colons separately
- fix merge mistake - use `fixture_dir` - only one invalid script per project in test data since we raise an exception on the first failure - improve tests a bit
radoering
force-pushed
the
script-error-msg
branch
from
February 10, 2024 14:38
8ee4f9a
to
b82c40e
Compare
radoering
approved these changes
Feb 10, 2024
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Check List
Related-to: #issue-number-here (partially)
A continuation of: #7756 since the author seems to have left the chat
More informative error messages when scripts are misspecified.
Main difference is that the error message has been updated with more information, and the no-context information ("too many/too few values to unpacked") is removed.
The previously proposed error message was still a bit too cryptic, so I added separate cases for "too many colons" vs "colons absent" because they are different problems - with no colons, one might be trying to specify a whole python module because their script runs module-level code. I added a hint in that case to just wrap it in a
main
function with a suggestion of how to changepyproject.toml
. The other case is just a warning that there are too many colons and shows what the current value is.So for "no colons" with a pyproject.toml like:
The error message is:
and for a "too many colons" with a pyproject.toml like:
the error message is:
I also removed script specifiers like
"foo.bar:baz.bin"
because they were misleading about what the test handled.It seems like the ultimate thing that needs to happen here is to add regex to the JSON schema file so that editors alert people before the time they try and install a package - https://github.com/python-poetry/poetry-core/blob/main/src/poetry/core/json/schemas/poetry-schema.json - but that's not for me today ;)