Pip: Docs: add instructions on config to default to new resolver

Created on 30 Jul 2020  路  10Comments  路  Source: pypa/pip

Some people would like to set an environment variable manually on the command line, or something in pypi.rc or pip.conf, so they can tell pip to default to the new resolver #6536 #988 and test it more easily, without having to manually include --use-feature=2020-resolver each time. Example via Twitter:

It would be handy to be able to enable the new deps resolver via an env var. This would allow testing it in conjunction with tools such as poetry and pipenv.

@Julian in IRC logs suggested editing pip.conf and daturkel says this worked:

[install]
use-feature = 2020-resolver

We should decide whether we want to support this, and then if we do, we should add a line about it to the how-to-test docs.

new resolver needs discussion docs

Most helpful comment

Note that if you modify configuration using

pip config set global.use-feature 2020-resolver

it isn't possible to disable the resolver simply using

pip config unset global.use-feature

Instead, you'll need

pip config unset --user global.use-feature

I see this behavior on Fedora 30, Python 3.7 and pip 20.2.

All 10 comments

This is standard pip functionality (both environment variable and config file), so yes, we should support it. I'm not sure we want to promote it, though, as I feel like it would be awfully easy for people to forget they had it set and use it in a live environment without meaning to.

@pfmoore the point on accidental production user is fair. In case of an environment variable it seems reasonable to advice using env utility or local .env file.

We do support this. I agree that we should mention this in the testing guide, albeit with a note/caveat mentioning how this will persist after you set it. I'm happy to expect folks who do this testing (which has "don't use in prod" very clearly stated) to be cautious and aware of the fact that they have set this variable/config-file value. :)

OK! What recommendation should we make?

I think the easiest way to do this might be pip config set global.use-feature 2020-resolver... so that? And mentioning PIP_USE_FEATURE (env var) as well.

The other option is describing how you have to edit the relevant file and the format of it.

Note that if you modify configuration using

pip config set global.use-feature 2020-resolver

it isn't possible to disable the resolver simply using

pip config unset global.use-feature

Instead, you'll need

pip config unset --user global.use-feature

I see this behavior on Fedora 30, Python 3.7 and pip 20.2.

I can't reproduce this on my Debian machine with CPython 3.8 and pip 20.2. pip config unset global.use-feature does unset the feature, but I notice that it unsets the entire option and AFAIK there's yet to be a way to deselect just one feature. I'm wondering if we want to support that, and if so I'll file a separate ticket tracking it.

@akaihola, I wonder what pip config debug says on your system.

@McSinyx, after running pip config set global.use-feature 2020-resolver, the pip config debug command shows

env_var:
env:
global:
  /etc/xdg/pip/pip.conf, exists: False
  /etc/pip.conf, exists: False
site:
  /usr/pip.conf, exists: False
user:
  /home/akaihola/.pip/pip.conf, exists: False
  /home/akaihola/.config/pip/pip.conf, exists: True

I think the easiest way to do this might be pip config set global.use-feature 2020-resolver... so that? And mentioning PIP_USE_FEATURE (env var) as well.

Let's add this to the documentation, with a link to this bug in case people need variations/help with the variations.

@akaihola Could you file a new issue for the behavior you're seeing? It seems like a bug in pip config or something that's more environment specific.

Was this page helpful?
0 / 5 - 0 ratings