-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
- Consistency with core Python venv config location.
- 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).
- No need for the user to know he has to manually create an etc directory in his venv.
Added a virtualenv-specific configuration file
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. |
No description provided.