Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

respect pip configuration at Pipfile creation #1008

Closed
wants to merge 1 commit into from

Conversation

hrbonz
Copy link
Contributor

@hrbonz hrbonz commented Nov 1, 2017

Respect pip index configuration (pip.conf or environment variable) when
creating a new Pipfile.

I'm really not sure about this implementation but I wanted to start the conversation, I've made some choices that I think have a minimal impact.

I couldn't find a convenient method in the pip project that would just hand me out the best option and respect the configuration precedence so I implemented it by hand.

Change mentioned in #856

Respect pip index configuration (pip.conf or environment variable) when
creating a new Pipfile
@hrbonz
Copy link
Contributor Author

hrbonz commented Nov 1, 2017

I feel like I should add some tests here

@techalchemy
Copy link
Member

Hey @hrbonz thanks for putting this together. Unfortunately altering which source is added to the Pipfile doesn’t quite respect pip.conf because of the way pip already generates its repository index list (which already should respect pip.conf) and because of the way the piptools resolver works (which isn’t affected by the Pipfile).

@hrbonz
Copy link
Contributor Author

hrbonz commented Nov 2, 2017

@techalchemy unfotunately, pip.conf is not respected because of the configuration precedence and the use of sources as indexes on the command line with -i/--index-url or --extra-index-url.

That is the base of the issue I described in #856

@techalchemy
Copy link
Member

@hrbonz I see what you're saying, but I'm not actually sure this is the right approach here. It's not clear that we actually want to always fall back to the default indexes in the host pip config, since I'm not sure that provides sufficient portability. I do think we would want to respect environment settings, however, but I think there is some discussion to have here (e.g. in #988 this came up)

We have broader design questions to answer but for now, I would be much more prepared to accept something that prioritizes environment level settings (e.g. PIP_INDEX_URL followed by an iterative list over PIP_EXTRA_INDEX_URL) -- this approach will probably need to take into account verify_ssl from the PIP_TRUSTED_HOST environment variable

@techalchemy
Copy link
Member

And before you rework, /cc @nateprewitt would you be willing to approve a PR to use PIP_INDEX_URL from the environment if it exists as the primary pip index (i.e. first entry in [[sources]] in the Pipfile? This seems like something that might impact existing users so I would want a second set of eyes on it

@kennethreitz
Copy link
Contributor

We should honor the environment variable instead.

@kennethreitz
Copy link
Contributor

not today, but thank you

@hrbonz
Copy link
Contributor Author

hrbonz commented Nov 14, 2017

There must be something I don't get, why force users to set an environment variable when there is already a configuration for a standard tool that gives you this information? This is, moreover, the tool you use under the hood.
Environment variables are useful in some situations but really not ideal most of the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants