jazzband / pip-tools

A set of tools to keep your pinned Python dependencies fresh.
https://pip-tools.rtfd.io
BSD 3-Clause "New" or "Revised" License
7.67k stars 608 forks source link

Extra index URL gets emitted when using both `--extra-index-url` and `--no-emit-index-url` #2046

Closed jamesbraza closed 7 months ago

jamesbraza commented 7 months ago

Running pip-compile --extra-index-url=https://download.pytorch.org/whl/nightly --no-emit-index-url will still paste the extra index URL in the requirements.txt.

Environment Versions

  1. OS Type macOS
  2. Python version: $ python -V Python 3.12.1 (main, Jan 6 2024, 20:42:19) [Clang 14.0.3 (clang-1403.0.22.14.1)]
  3. pip version: $ pip --version 23.3.2
  4. pip-tools version: $ pip-compile --version 7.3.0

Steps to replicate

# requirements.in
torch

Expected result

#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
#    pip-compile --no-emit-index-url
#

Actual result

#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
#    pip-compile --extra-index-url=https://download.pytorch.org/whl/nightly --no-emit-index-url
#
chrysle commented 7 months ago

Right, but why would you want to combine these two options?

jamesbraza commented 7 months ago

I guess I didn't want the torch extra index URL in my requirements.txt, but I don't have a particularly good reason.

Are you thinking that --extra-index-url wins out over --no-emit-index-url, if both are specified?

chrysle commented 7 months ago

Are you thinking that --extra-index-url wins out over --no-emit-index-url, if both are specified?

That'd be my reasoning, yes.

jamesbraza commented 7 months ago

Okay gotchu, well that's how it behaves now.

I am gonna close this out then, I guess it's not a bug but intended behavior