Skip to content

Conversation

@amitsaha
Copy link

@amitsaha amitsaha commented Jan 5, 2016

No description provided.

@amitsaha amitsaha changed the title Virtualenv tutorial (Issue #202) Virtualenv tutorial (issue #202) Jan 5, 2016
Copy link
Contributor

Choose a reason for hiding this comment

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

So this is going to be something that comes up in a couple places: in the general case, we should refer to "virtual environments" and only refer to "virtualenv" for Python 2 users and "venv" (and pyvenv) for Python 3 users. They both create virtual environments, but the tools have different names.

Copy link
Member

Choose a reason for hiding this comment

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

FWIW virtualenv still works on Python 3 and it's likely folks might still want to use that over pyvenv. Reasoning:

  • pyvenv only exists in 3.3+, so if you want to use 3.2 you're stuck.
  • pyvenv only installs pip in 3.4+, so if you want to use 3.3 you have to get your own pip.
  • pyvenv is tied to a specific version of Python, so you'll get different versions of pip (and thus different behavior from pip) depending on what version of Python you're using.
  • pyvenv is tied to a specific version of Python, so you'll get different options, flags, etc available based on the Python version.

Longer term, virtualenv will be rewritten to take advantage of the isolation mechanism provided by pyvenv but still provide it's own pip and such to make it easier to have something creating a virtual environment with an up to date copy of the bundled tooling and that works the same across all versions of Python.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dstufft Oh, those are some important distinctions (I didn't notice pyvenv wasn't in Python until 3.3)! In light of that, I'm tempted to say we should suggest virtualenv for all readers (Python 2 and 3 users alike), in the interest of having it Just Work. Is there a good reason not to use virtualenv on Python 3.3+?

Copy link
Member

Choose a reason for hiding this comment

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

Currently virtualenv doesn't take advantage of the better isolation mechanism introduced by pyvenv, it still uses the total black magic hack which can break sometimes (particularly on brand new versions of Python). Also it doesn't come with Python.

The first of those will hopefully be solved at some point in the future, the second of those will always be true.

Copy link
Member

Choose a reason for hiding this comment

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

At the moment, "use virtualenv" is probably the simplest "one solution suits everyone" advice. But I'm uncomfortable about not letting people know that Python 3 has a better native virtual environment facility. I suspect my discomfort merely reflects that I'm not a good person to write beginner-focused documentation, though :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, after sleeping on this one, I think we should go with "use virtualenv" for Python 2.7-3.2 users and "use pyvenv" for 3.3+. As much I'd like to go with a one-size fits all solution, I think there's something to be said for acknowledging that Python is changing thing. And if test readers say that doesn't work for them, then we can always change it.

Copy link
Author

Choose a reason for hiding this comment

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

Cool, thanks all for the comments, I will address them in my next update.

@ddbeck
Copy link
Contributor

ddbeck commented Jan 6, 2016

Thanks, @amitsaha! This is a great start. I'm very happy with you've done. I've made a few comments (a few minor things, one or two substantive things). Would you look over my comments and let me know if you have any questions? Thanks!

@amitsaha
Copy link
Author

@ddbeck Please take a look at the updated doc now. Thanks for all the tips.

Copy link
Contributor

Choose a reason for hiding this comment

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

We want pip instead of pip3. If a virtualenv is actually activated, pip3 can't be better - and additionally, of course, running pip3 in a python 2 virtualenv will only get you wrong results.

@ddbeck
Copy link
Contributor

ddbeck commented Jan 21, 2016

@amitsaha I'm very happy with this new draft! Thank you for making all those revisions! There are a few style guide-related things I'd like to revise, but they're nitpicks. I'll figure out how to merge your changes to develop, then make those style changes and, while I'm at it, fix the issue that @Ivoz noted.

Thanks again!

Copy link
Member

Choose a reason for hiding this comment

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

This isn't true everywhere - on Windows at least, pyvenv is not on the path by default. I would suggest python -m venv as the canonical way of running pyvenv.

@amitsaha
Copy link
Author

Thank you all for the comments. @ddbeck do you mean you are happy with this for now?

@ddbeck
Copy link
Contributor

ddbeck commented Jan 28, 2016

@amitsaha Yes, definitely! I had planned to set up a table of contents and merge your work this week but things sort of got away from me. I hope to catch up on this soon. Thanks for your patience. 😄

@amitsaha
Copy link
Author

@ddbeck No problems 👍 Looking forward to the docs.

ddbeck pushed a commit that referenced this pull request Feb 7, 2016
This completes the work required to merge PR #211 (corresponding to issue #202)
also included as part of issue #194.
ddbeck pushed a commit that referenced this pull request Feb 7, 2016
ddbeck pushed a commit that referenced this pull request Feb 7, 2016
@ddbeck
Copy link
Contributor

ddbeck commented Feb 7, 2016

@amitsaha I have merged your changes (2e1d5aa, 9682448) to develop! 🎉 Thanks again for your patience!

Since I have merged the changes manually, I am going to close this PR. If you want to make any changes to this or other sections, feel free to start a new PR. 😄

@ddbeck ddbeck closed this Feb 7, 2016
@amitsaha
Copy link
Author

amitsaha commented Feb 7, 2016

Thanks @ddbeck - looks great.

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.

5 participants