-
-
Notifications
You must be signed in to change notification settings - Fork 613
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 pip-compile
to properly exclude non-relevant options from output header
#2066
Conversation
Thanks! As it should be worthwhile to include diff --git a/piptools/utils.py b/piptools/utils.py
index 3b2061f..fc03846 100644
--- a/piptools/utils.py
+++ b/piptools/utils.py
@@ -371,9 +371,13 @@ def get_compile_command(click_ctx: click.Context) -> str:
# Get the latest option name (usually it'll be a long name)
option_long_name = option.opts[-1]
+ negative_option = None
+ if option.is_flag:
+ negative_option = f"--no-{option_long_name.lstrip('--')}"
+
# Exclude one-off options (--upgrade/--upgrade-package/--rebuild/...)
# or options that don't change compile behaviour (--verbose/--dry-run/...)
- if option_long_name in COMPILE_EXCLUDE_OPTIONS:
+ if option_long_name or negative_option in COMPILE_EXCLUDE_OPTIONS:
continue Moreover, since the pull request title will be included in the user-facing changelog, and I categorise this as a bugfix rather than a feature, as the title suggests, would you be fine with changing it to something like "Fix superfluous inclusion of |
As it currently stands, Lines 341 to 343 in 1197151
Lines 392 to 394 in 1197151
& Yeah reuse-hashes is the default: pip-tools/piptools/scripts/options.py Lines 229 to 237 in 1197151
Even if the above wasn't the case, your suggested changes wouldn't allow through a if option.is_flag and value == False:
option_long_name = negative_option I can still apply your suggested changes, looks to be more clear and allows for embedding the inverse flags within the I do have to push back on the suggested commit summary change though, especially with your changes it does become solely a "fix |
7a3e028
to
afea6e6
Compare
Ah, you're correct, I didn't realise that.
How about "Fix |
Works for me, thanks for helping me along with this! |
pip-compile
to properly exclude non-relevant options from output header
OH I did misunderstand @chrysle I was focusing on the commit message. does that get added to the changelog too or is it purely the PR title? |
Yes, since we're using the |
Fixes: jazzband#2065 See: jazzband#1197 This is specifically for the --no-reuse-hashes found in COMPILE_EXCLUDE_OPTIONS but makes way for future inverse flags in the list too.
Fixes #2065
Click context only had positive --reuse-hashes to loop over, inverse is automatically deduced.
Contributor checklist
Maintainer checklist
backwards incompatible
,feature
,enhancement
,deprecation
,bug
,dependency
,docs
orskip-changelog
as they determine changelog listing.