-
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
fix(run): simplify and fix run arg parsing #10067
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis PR simplifies the argument parsing for the No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @abn - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
aeb98fb
to
2a053a7
Compare
Thank you for tackling this bug – it's a really thorny issue. I'm still seeing a lot of problems, and provide detailed reproduction steps below. I don't fully understand what's going on, but hope that the test cases help. I think this means that any command line parameter munging based on heuristics like "there is a token called Reproduction stepsI tried to exhaustively check different styles of passing the #!/bin/bash
set -euo pipefail
poetry="${1:-poetry}"
workdir="$(mktemp -d)"
cd "$workdir"
"$poetry" new run # create a new package called "run"
ln -sT run somepackage
eza -aT # show directory structure
experiment() {
if "$@"; then
echo PASS: "$*"
else
echo FAIL: "$*"
# exit 1 # uncomment this line to turn into automated test
fi
}
# start experiments, ALL of these should just echo "hi"
for package in run somepackage; do
experiment env --chdir=$package "$poetry" run echo hi # test without -P/--project option
# option before "run" command
experiment "$poetry" -P $package run echo hi
experiment "$poetry" -P$package run echo hi
experiment "$poetry" --package $package run echo hi
experiment "$poetry" --package=$package run echo hi
# option after "run" command
experiment "$poetry" run -P $package echo hi
experiment "$poetry" run -P$package echo hi
experiment "$poetry" run --package $package echo hi
experiment "$poetry" run --package=$package echo hi
done
cd -
rm -r "$workdir" The Output of my tests:
As we can see, most of the invocation styles still fail. It is easier to enumerate what did work:
For the failures, some seem to truncate the package path to the first letter (before turning it into an absolute path):
Other failures seem to ignore the
On a few cases, the subcommand detection seems to fail:
I also repeated the test with Poetry 2.0.1, which passes 6 test cases, which is one more than in 9d9cf30. Specifically, the example |
I'll look into it. But quite honestly I'll be happy if things are better than it was, and we should be careful of optimizing for edge cases too much. :) |
Resolves: #10051
Summary by Sourcery
Simplify the parsing of arguments for the "run" command and fix a bug related to passing arguments after the command name.
Bug Fixes:
Enhancements: