get_compile_command emits --no-index unconditionally with click 8.5.0
Describe the Bug
With click 8.5.0, pip-compile writes --no-index into the recorded command, even when it was not passed.
This is only in the recorded command text. The actual resolve step still uses the index.
Expected Behaviour
The recorded command should not include --no-index unless it was really passed.
Steps to Reproduce
pip install pip-tools "click==8.5.0"echo requests > req.inpip-compile req.inhead -6 req.txt
Result:
# pip-compile req.in --no-index--no-index was never passed.
I checked click.Option(['--no-index'], is_flag=True).default on different click versions. It is False on 8.2.1, 8.3.0, 8.4.0, 8.4.2. It becomes Sentinel.UNSET on 8.5.0. So this is a new bug from click 8.5.0, not the one fixed in #2235 / #2236.
The cause on the click side: pallets/click#3641 (pallets/click@8f30085, in 8.5.0) removed the old eager coercion self.default = False for boolean flags at __init__ time. Now Option.default stays UNSET unless resolved through get_default().
get_compile_command in piptools/utils.py still compares option.default == value to skip options at their default. For --no-index (a flag with no negative form), this check never matches on click 8.5.0. So the flag name always gets added, no matter its real value.
Environment Versions
- pip-tools 7.6.1 (still present on current
main) - click 8.5.0 (not on 8.2.1 / 8.3.0 / 8.4.0 / 8.4.2)
- Python 3.13
Source: jazzband/pip-tools