Skip to content

Using negative flag forms (e.g. no-header, no-annotate) in config has no effect #1909

@AndydeCleyre

Description

@AndydeCleyre

When testing out the new config behavior, if I add entries to [tool.pip-tools] like

no-annotate = true

or

no-header = true

then there are two surprises:

  • the option does not take effect; it must be given in the positive form (annotate = false and header = false)
  • there is no warning or error about unknown options being given, making this problem easy to miss

Environment Versions

  1. Linux
  2. Python version: 3.10.6
  3. pip version: 23.1.2
  4. pip-tools version: 6.14.0

Steps to replicate

$ git clone https://github.com/jazzband/pip-tools
$ cd pip-tools
$ printf '%s\n' '[tool.pip-tools]' 'no-annotate = true' >>pyproject.toml
$ printf '%s\n' httpx >requirements.in
$ python -m venv .venv
$ . ./.venv/bin/activate
$ pip install -U pip pip-tools
$ pip-compile requirements.in

Expected result

Either

  • there be no annotations in the output, since --no-annotate is a valid flag, and --no-annotate should also appear in the generated header, or
  • a warning or error should be presented due to an unrecognized option being supplied

Actual result

WARNING: the legacy dependency resolver is deprecated and will be removed in future versions of pip-tools. The default resolver will be changed to 'backtracking' in pip-tools 7.0.0. Specify --resolver=backtracking to silence this warning.
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile requirements.in
#
anyio==3.7.1
    # via httpcore
certifi==2023.5.7
    # via
    #   httpcore
    #   httpx
exceptiongroup==1.1.2
    # via anyio
h11==0.14.0
    # via httpcore
httpcore==0.17.3
    # via httpx
httpx==0.24.1
    # via -r requirements.in
idna==3.4
    # via
    #   anyio
    #   httpx
sniffio==1.3.0
    # via
    #   anyio
    #   httpcore
    #   httpx

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not workingconfigRelated to pip-tools' configuration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions