-
-
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 rejection of negating CLI boolean flags in config #1913
Fix rejection of negating CLI boolean flags in config #1913
Conversation
37664bf
to
401c5fd
Compare
for more information, see https://pre-commit.ci
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.
@chrysle thank you very much for fixing this! I've left a few comments above for code improvement.
…pip-tools into support-boolean-flags-in-config
Thanks for the review! I've tried to apply your suggestions. |
* Refactor-out parse_config_file() * Fix failing tests * Naming * Naming
And correct README filename in `tox` session.
Sure, I added a small paragraph. |
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.
Thanks for the docs! A few comments to consider below:
README.md
Outdated
Since `pip-tools` supports default values vor [all valid command-line flags](/cli/index.md) | ||
of its subcommands, you can also achieve the functionality in the above example | ||
by setting a configuration value for the negative flag `--no-annotate`: | ||
|
||
```toml | ||
[tool.pip-tools] | ||
no-annotate = false | ||
``` | ||
|
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.
This may seem like a special case. However, we essentially support any long options (those starting with -- prefix) listed in command line reference represented in either snake or kebab case (without the double dash). Perhaps it's worth mentioning this instead? What do you think?
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.
Apparently, the Sphinx TOML lexer doesn't seem to concur with that suggestion...
Perhaps it isn't such a good idea to support both cases, then?
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.
See #1913 (comment)
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.
I've tested that configuration though, and seen it work...
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.
It might work, since we do the normalization before the validation for now. However, we should not encourage this, because it will be fixed soon.
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.
We may be able to call _validate_config()
directly in _invert_negative_bool_options_in_config()
.
Thanks, I agree with your points and reworked the documentation. |
Sorry for the misunderstanding, I hope it's better now. |
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.
Thanks @chrysle! 🎉
@chrysle a side-note about changelog: "Add support" usually goes to "Features" section. Do you think it would make sense to either rephrase the PR title or reconsider its labels? |
Thanks for pointing out! How about:
|
Closes #1909
Contributor checklist
Maintainer checklist
backwards incompatible
,feature
,enhancement
,deprecation
,bug
,dependency
,docs
orskip-changelog
as they determine changelog listing.