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

Add a recipe for setting up a virtualenv #5

Merged
merged 4 commits into from
Feb 28, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 50 additions & 13 deletions docs/recipes/virtualenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ that uses SCons to build. A virtualenv is a way to create an
isolated execution environment - you can install whatever you need
there, and change versions as needed, without affecting anything
else on your system that uses Python. Here is an example session
for setting one up:
for setting one up on a Linux host:

.. code:: shell

$ cd Work
$ python -m venv myvenv
$ cd myvenv
$ source bin/activate
Copy link
Contributor

Choose a reason for hiding this comment

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

source myvenv/bin/activate

Copy link
Contributor

Choose a reason for hiding this comment

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

and actually . myvenv/bin/activate should also work. (that's what I typically do, less typing.. )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, hand-editing logs never works out right

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can trim these further if you want - just trying to figure out what still needs doing here to complete this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup. If you can fix that, then we're good to go.

(myvenv) $ python -m pip list --outdated
(myvenv) $ pip list --outdated
Package Version Latest Type
---------- ------- ------ -----
pip 19.3.1 21.0.1 wheel
setuptools 41.6.0 53.0.0 wheel
WARNING: You are using pip version 19.3.1; however, version 21.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(myvenv) $ python -m pip install --upgrade pip setuptools scons
(myvenv) $ pip install --upgrade pip setuptools scons
Collecting pip
Downloading https://files.pythonhosted.org/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5MB)
|................................| 1.5MB 909kB/s
Expand All @@ -38,16 +37,10 @@ for setting one up:
Uninstalling setuptools-41.6.0:
Successfully uninstalled setuptools-41.6.0
Successfully installed pip-21.0.1 scons-4.1.0.post1 setuptools-53.0.0
(myvenv) $ python -m pip list
Package Version
---------- -----------
pip 21.0.1
SCons 4.1.0.post1
setuptools 53.0.0
(myvenv) [mats@boulder myvenv]$ scons --version
(myvenv) $ scons --version
SCons by Steven Knight et al.:
SCons: v4.1.0.post1.dc58c175da659d6c0bb3e049ba56fb42e77546cd, 2021-01-20 04:32:28, by bdbaddog on ProDog2020
SCons path: ['/home/mats/Work/myvenv/lib64/python3.8/site-packages/SCons']
SCons path: ['/home/user/Work/myvenv/lib64/python3.8/site-packages/SCons']
Copyright (c) 2001 - 2021 The SCons Foundation
(myvenv) $ deactivate
$
Expand All @@ -61,5 +54,49 @@ any additional requirements your project may have

$ cd Work/myproject
$ source ~/Work/myvenv/bin/activate
$ python -m pip install -r requirements.txt
(myvenv) $ pip install -r requirements.txt


Here is the same session from a Windows host:

.. code:: cmd

C:\Users\user>cd Work

C:\Users\user\Work>py -m venv myvenv

C:\Users\user\Work>.\myvenv\Scripts\activate

(myvenv) C:\Users\user\Work>pip list --outdated
Package Version Latest Type
---------- ------- ------ -----
pip 20.2.3 21.0.1 wheel
setuptools 49.2.1 53.0.0 wheel
WARNING: You are using pip version 20.2.3; however, version 21.0.1 is available.
You should consider upgrading via the 'C:\Users\user\Work\myvenv\Scripts\python.exe -m pip install --upgrade pip' command.

(myvenv) C:\Users\user\Work\myvenv\Scripts\python.exe -m pip install --upgrade pip setuptools scons
Collecting pip
Using cached pip-21.0.1-py3-none-any.whl (1.5 MB)
Collecting setuptools
Using cached setuptools-53.0.0-py3-none-any.whl (784 kB)
Collecting scons
Using cached SCons-4.1.0.post1-py3-none-any.whl (4.1 MB)
Installing collected packages: pip, setuptools, scons
Attempting uninstall: pip
Found existing installation: pip 20.2.3
Uninstalling pip-20.2.3:
Successfully uninstalled pip-20.2.3
Attempting uninstall: setuptools
Found existing installation: setuptools 49.2.1
Uninstalling setuptools-49.2.1:
Successfully uninstalled setuptools-49.2.1
Successfully installed pip-21.0.1 scons-4.1.0.post1 setuptools-53.0.0

(myvenv) C:\Users\user\Work>scons --version
SCons by Steven Knight et al.:
SCons: v4.1.0.post1.dc58c175da659d6c0bb3e049ba56fb42e77546cd, 2021-01-20 04:32:28, by bdbaddog on ProDog2020
SCons path: ['c:\\users\\user\\work\\myvenv\\lib\\site-packages\\SCons']
Copyright (c) 2001 - 2021 The SCons Foundation

(myvenv) C:\Users\user\Work>