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

Projects
None yet
5 participants
@pfmoore
Member

pfmoore commented Dec 4, 2013

No description provided.

Show outdated Hide outdated docs/configuration.rst Outdated
Show outdated Hide outdated tests/unit/test_options.py Outdated
if running_under_virtualenv():
venv_config_file = os.path.join(sys.prefix, default_config_basename)
if os.path.exists(venv_config_file):
files.append(venv_config_file)

This comment has been minimized.

@qwcode

qwcode Dec 4, 2013

Contributor

so previously, pip has never exercised the multi-file support of ConfigParser. not sure how the layering works with that? are you comfortable with that?

@qwcode

qwcode Dec 4, 2013

Contributor

so previously, pip has never exercised the multi-file support of ConfigParser. not sure how the layering works with that? are you comfortable with that?

This comment has been minimized.

@pfmoore

pfmoore Dec 4, 2013

Member

I did check it - it does what I'd expect (later files take precedence over earlier ones where section/key names clash). Yes, I'm comfortable with it.

@pfmoore

pfmoore Dec 4, 2013

Member

I did check it - it does what I'd expect (later files take precedence over earlier ones where section/key names clash). Yes, I'm comfortable with it.

@qwcode

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode Dec 4, 2013

Contributor

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

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)

This comment has been minimized.

@jezdez

jezdez Dec 6, 2013

Contributor

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

@jezdez

jezdez Dec 6, 2013

Contributor

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

This comment has been minimized.

@pfmoore

pfmoore Dec 6, 2013

Member

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.

@pfmoore

pfmoore Dec 6, 2013

Member

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.

This comment has been minimized.

@jezdez

jezdez Dec 6, 2013

Contributor

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.

@jezdez

jezdez Dec 6, 2013

Contributor

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.

This comment has been minimized.

@thedrow

thedrow Dec 8, 2013

@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.

@thedrow

thedrow Dec 8, 2013

@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.

This comment has been minimized.

@pfmoore

pfmoore Dec 8, 2013

Member

@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

pfmoore Dec 8, 2013

Member

@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

Merge pull request #1364 from pfmoore/virtualenv_config
Added a virtualenv-specific configuration file

@pfmoore pfmoore merged commit c3e3586 into pypa:develop Dec 8, 2013

1 check failed

default The Travis CI build failed
Details

@pfmoore pfmoore deleted the pfmoore:virtualenv_config branch Dec 8, 2013

@Ivoz

This comment has been minimized.

Show comment
Hide comment
@Ivoz

Ivoz Apr 30, 2014

Member

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.

Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment