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

Added a virtualenv-specific configuration file #1364

Merged
merged 2 commits into from
Dec 8, 2013

Conversation

pfmoore
Copy link
Member

@pfmoore pfmoore commented Dec 4, 2013

No description provided.

directory of the virtualenv (``sys.prefix`` as reported by Python). The base
name of the file is the same as the user configuration file (:file:`pip.conf`
on Unix and OSX, :file:`pip.ini` on Windows). Values in the virtualenv-specific
configuration file take precedence over those in the user configuration file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and precedence over a config file specified using PIP_CONFIG_FILE

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was seeing PIP_CONFIG_FILE as just changing the location if "the user configuration file", but I'll see if I can word this more clearly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, it seems to me we should have a real option for --config-file. PIP_CONFIG_FILE is the only odd ball case where we have an environment option without a comand option.

@qwcode
Copy link
Contributor

qwcode commented Dec 4, 2013

also, btw, see #848 for a global config file. similar diff.

else:
files = [default_config_file]
if running_under_virtualenv():
venv_config_file = os.path.join(sys.prefix, default_config_basename)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be like <venv>/etc/pip.conf? That would stay in compatibility to a potential global pip config.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no env subdirectory on Windows (and no standard sysconfig location like bin_dir or lib_dir) I put it in sys.prefix because that's where the standard Python venv puts its parameter file (although the reason for that file is different).

If it should go in /etc on Unix I could do that - but I wouldn't want to for Windows. Also, should virtualenv create an etc directory? Or should the user be required to create the directory in order to add the per-venv file (and know that they need to do that on Unix but not Windows)?

Personally I think it's more compexity than the feature warrants, but I can do it if the Unix people think it's worth it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't know the core venv does that, interesting. Yeah, for the sake of simplicity I agree sys.prefix is a good choice. Thanks for the clarification, @pfmoore.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pfmoore I do believe it should be in /etc/ for Unix systems. It is consistent with how a virtualenv looks like in those systems. We can find the Python executable on /venv/bin/ for example but on windows we will find it on /venv/Scripts. There should be a difference because that's how those OSes behave.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thedrow I'm going to stick with sys.prefix.. Reasons:

  1. Consistency with core Python venv config location.
  2. Less inconsistency between Unix and Windows (bin vs Scripts is a continual source of irritation, I don't want to do more of the same).
  3. No need for the user to know he has to manually create an etc directory in his venv.

pfmoore added a commit that referenced this pull request Dec 8, 2013
Added a virtualenv-specific configuration file
@pfmoore pfmoore merged commit c3e3586 into pypa:develop Dec 8, 2013
@pfmoore pfmoore deleted the virtualenv_config branch December 8, 2013 20:27
@Ivoz
Copy link
Contributor

Ivoz commented Apr 30, 2014

We might want to revisit this in relation to #1733. I myself would prefer we standardize on a single filename, irrespective of the OS. Additionally, I consider using virtualenv one of the ways to try and make "what OS do you use" an irrelevant question to ask, making it easier for anyone inside a virtualenv to have whatever they're doing work exactly the same, whichever OS they're using outside of it.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants