Skip to content

Commit 0d8ac4a

Browse files
docs: Show virtual environment creation and activation separately (#38)
* Also rename 'alrb-example' to 'atlas-ab-example'. * Update usage example to show virtual environment creation and then activation. * Show correct full resetup of environment with --setup.
1 parent 4050c4a commit 0d8ac4a

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

README.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $ chmod +x ~/.local/bin/cvmfs-venv
2222
Source the script to create a Python 3 virtual environment that can coexist with a CVMFS LCG view. The default name is `venv`.
2323

2424
```console
25-
$ . cvmfs-venv --help
25+
$ cvmfs-venv --help
2626
Usage: cvmfs-venv [-s|--setup] [--no-system-site-packages] [--no-update] <virtual environment name>
2727

2828
Options:
@@ -45,29 +45,33 @@ Examples:
4545

4646
setupATLAS -3
4747
lsetup 'views LCG_102 x86_64-centos7-gcc11-opt'
48-
. cvmfs-venv lcg-example
48+
cvmfs-venv lcg-example
49+
. lcg-example/bin/activate
4950

50-
* Create a Python 3 virtual environment named 'alrb-example' with the Python
51-
runtime provided by ATLAS AnalysisBase release v22.2.113.
51+
* Create a Python 3 virtual environment named 'atlas-ab-example' with the
52+
Python runtime provided by ATLAS AnalysisBase release v22.2.113.
5253

5354
setupATLAS -3
5455
asetup AnalysisBase,22.2.113
55-
. cvmfs-venv alrb-example
56+
cvmfs-venv atlas-ab-example
57+
. atlas-ab-example/bin/activate
5658

5759
* Create a Python 3 virtual environment named 'venv' with whatever Python
5860
runtime "\$(command -v python3)" evaluates to.
5961

60-
. cvmfs-venv
62+
cvmfs-venv
63+
. venv/bin/activate
6164

6265
* Setup LCG view 102 on CentOS7 and create a Python virtual environment
6366
named 'lcg-example' using the Python 3.9 runtime it provides.
6467

6568
. cvmfs-venv --setup "lsetup 'views LCG_102 x86_64-centos7-gcc11-opt'" lcg-example
6669

6770
* Setup ATLAS AnalysisBase release v22.2.113 and create a Python virtual
68-
environment named 'alrb-example' using the Python 3.9 runtime it provides.
71+
environment named 'atlas-ab-example' using the Python 3.9 runtime it
72+
provides.
6973

70-
. cvmfs-venv --setup 'asetup AnalysisBase,22.2.113' alrb-example
74+
. cvmfs-venv --setup 'asetup AnalysisBase,22.2.113' atlas-ab-example
7175
```
7276

7377
### Example: Virtual environment with LCG view
@@ -78,15 +82,16 @@ $ ssh lxplus
7882
[feickert@lxplus732 ~]$ export PATH=~/.local/bin:"${PATH}"
7983
[feickert@lxplus732 ~]$ curl -sL https://raw.githubusercontent.com/matthewfeickert/cvmfs-venv/main/cvmfs-venv.sh -o ~/.local/bin/cvmfs-venv
8084
[feickert@lxplus732 ~]$ chmod +x ~/.local/bin/cvmfs-venv
81-
[feickert@lxplus732 ~]$ . cvmfs-venv --setup "lsetup 'views LCG_102 x86_64-centos7-gcc11-opt'" lcg-example
82-
83-
lsetup 'views LCG_102 x86_64-centos7-gcc11-opt'
85+
[feickert@lxplus732 ~]$ setupATLAS -3 --quiet
86+
[feickert@lxplus732 ~]$ lsetup 'views LCG_102 x86_64-centos7-gcc11-opt'
8487
************************************************************************
8588
Requested: views ...
8689
Setting up views LCG_102:x86_64-centos7-gcc11-opt ...
8790
>>>>>>>>>>>>>>>>>>>>>>>>> Information for user <<<<<<<<<<<<<<<<<<<<<<<<<
8891
************************************************************************
92+
[feickert@lxplus732 ~]$ cvmfs-venv lcg-example
8993
# Creating new Python virtual environment 'lcg-example'
94+
[feickert@lxplus732 ~]$ . lcg-example/bin/activate
9095
(lcg-example) [feickert@lxplus732 ~]$ python -m pip show lhapdf # Still have full LCG view
9196
Name: LHAPDF
9297
Version: 6.5.1
@@ -188,7 +193,7 @@ This is done by injecting Bash snippets directly into the `bin/activate` script
188193
* Once the virtual environment is setup and modified there is no additional dependency on the `cvmfs-venv` script that generated it.
189194
- While it saves time it is not needed. You can setup the environment again without it.
190195
```console
191-
$ . cvmfs-venv venv
196+
$ . cvmfs-venv --setup "lsetup 'views LCG_102 x86_64-centos7-gcc11-opt'" venv
192197
```
193198
vs.
194199
```console

cvmfs-venv.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,33 @@ Examples:
2727
2828
setupATLAS -3
2929
lsetup 'views LCG_102 x86_64-centos7-gcc11-opt'
30-
. cvmfs-venv lcg-example
30+
cvmfs-venv lcg-example
31+
. lcg-example/bin/activate
3132
32-
* Create a Python 3 virtual environment named 'alrb-example' with the Python
33-
runtime provided by ATLAS AnalysisBase release v22.2.113.
33+
* Create a Python 3 virtual environment named 'atlas-ab-example' with the
34+
Python runtime provided by ATLAS AnalysisBase release v22.2.113.
3435
3536
setupATLAS -3
3637
asetup AnalysisBase,22.2.113
37-
. cvmfs-venv alrb-example
38+
cvmfs-venv atlas-ab-example
39+
. atlas-ab-example/bin/activate
3840
3941
* Create a Python 3 virtual environment named 'venv' with whatever Python
4042
runtime "\$(command -v python3)" evaluates to.
4143
42-
. cvmfs-venv
44+
cvmfs-venv
45+
. venv/bin/activate
4346
4447
* Setup LCG view 102 on CentOS7 and create a Python virtual environment
4548
named 'lcg-example' using the Python 3.9 runtime it provides.
4649
4750
. cvmfs-venv --setup "lsetup 'views LCG_102 x86_64-centos7-gcc11-opt'" lcg-example
4851
4952
* Setup ATLAS AnalysisBase release v22.2.113 and create a Python virtual
50-
environment named 'alrb-example' using the Python 3.9 runtime it provides.
53+
environment named 'atlas-ab-example' using the Python 3.9 runtime it
54+
provides.
5155
52-
. cvmfs-venv --setup 'asetup AnalysisBase,22.2.113' alrb-example
56+
. cvmfs-venv --setup 'asetup AnalysisBase,22.2.113' atlas-ab-example
5357
EOF
5458

5559
return 0

0 commit comments

Comments
 (0)