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.69k stars 610 forks source link

Validate config raises error for options specific to only one CLI command #1944

Closed sobayed closed 1 year ago

sobayed commented 1 year ago

With pip-tools version 7.1.0 I'm getting an error message (see "Actual result") when running pip-sync with the following configuration in pyproject.toml:

[tool.pip-tools]
emit-index-url = false

Maybe I missed how to specify options for a specific CLI command, but I couldn't find any related info in the docs.

Environment Versions

  1. OS Type: Win 10
  2. Python version: 3.9.12
  3. pip version: 23.2.1
  4. pip-tools version: 7.1.0

Steps to replicate

  1. Add a CLI option to config (e.g., in pyproject.toml) that is only used by one CLI command (e.g., --no-emit-index-url for pip-compile)
  2. Run a CLI command which does not use said option (e..g, pip-sync)

Expected result

Validation error is only raised for options that are relevant to the respective CLI command.

Actual result

❯ pip-sync -h
Usage: pip-sync [OPTIONS] [SRC_FILES]...
Try 'pip-sync -h' for help.

Error: No such config key 'emit_index_url'. (Possible options: extra_index_url, index_url)
atugushev commented 1 year ago

Thanks for the issue! That's fixed in #1933 and not yet released.

atugushev commented 1 year ago

Released as part of pip-tools v7.2.0