💥 Breaking Change (v0.36.0): default handling of unmatched glob patterns in cmd tasks #314
nat-n
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
Cmd tasks support a subset of bash syntax with a pure python implementation, which including glob expansion.
Reason to change
However prior to 0.36.0 cmd tasks resolved a glob pattern with zero matches to an empty result. This is similar to how bash behaves only when the nullglob shell option is set. Although this was intuitive on some level and made some tasks easier to write, it also caused some confusion (#234, #191, #264), so it was decided to changes the default behaviour to more closely match familiar shell environments.
What's new?
As of 0.36.0 poethepoet will by default pass unmatched glob patterns through to the command. This will hopefully result in less surprising behaviour for most users. Cmd tasks also accept a new
empty_glob
task option to control this behaviour with three modes:empty_glob: "pass"
: this is the new default and results in unmatched glob patterns being passed through to the command unchangedempty_glob: "null"
: this is the old default and results in an unmatched glob pattern being replaced with null (zero words) in the commandempty_glob: "fail"
: causes the task execution to fail with and error in case a glob pattern has no matchesWhat's breaking?
Unfortunately this is a breaking change and may cause tasks that previously worked to fail unexpectedly. For example a task like the following will now fail if the glob pattern is empty.
How to fix it
Fortunately this is easy to fix, by either restoring the previous default behaviour with the new task option, or in this specific example by using the provided script task like so (which also has the benefit of being cross platform!):
I hope this breaking change doesn't cause any major annoyance. Breaking change in poethepoet are very rare, but in this case I think it's for the best.
Beta Was this translation helpful? Give feedback.
All reactions