@@ -117,26 +117,23 @@ $ vien call main.py
117
117
118
118
# "create" command
119
119
120
- ` vien create ` сreates a virtual environment that will correspond the
121
- ** project directory** . Subsequent calls to ` vien `
120
+ ` vien create ` сreates a virtual environment that will correspond the
121
+ ** project directory** . Subsequent calls to ` vien `
122
122
with the same project directory will use the same virtual environment.
123
123
124
124
``` bash
125
125
$ cd /abc/myProject
126
126
$ vien create
127
127
```
128
128
129
- By default, the current ** working directory** is assumed to be the
130
- ** project directory** .
131
-
132
- Alternatively you can use ` -p ` parameter.
129
+ By default, the current ** working directory** is assumed to be the
130
+ ** project directory** . You can override this with ` -p ` argument.
133
131
134
132
``` bash
135
133
$ vien -p /abc/myProject create
136
134
```
137
135
138
-
139
- The ` -p ` parameter works with all commands, not just ` create ` .
136
+ The ` -p ` argument works with all commands, not only ` create ` .
140
137
141
138
``` bash
142
139
$ cd /other/working/dir
@@ -146,8 +143,21 @@ $ vien -p /abc/myProject shell
146
143
147
144
### "create": choose the Python version
148
145
149
- If you have more than one Python installed, you can provide an argument to point
150
- to the proper interpreter.
146
+ If you have several versions of Python installed, then virtual environments can
147
+ help you switch not only between dependencies, but also between interpreters.
148
+
149
+ ``` bash
150
+ $ cd /abc/my_old_project
151
+ $ vien run python --version # 3.7
152
+
153
+ $ cd /abc/my_newer_project
154
+ $ vien run python --version # 3.9
155
+ ```
156
+
157
+ A project directory can be bound to only one specific interpreter.
158
+
159
+ To indicate which interpreter to use with the project, provide an argument
160
+ pointing the executable.
151
161
152
162
``` bash
153
163
$ vien create /usr/local/opt/python@3.8/bin/python3
@@ -160,11 +170,10 @@ be executed in the shell as `python3.8`, you can try
160
170
$ vien create python3.8
161
171
```
162
172
163
- When ` create ` is called with no argument, ` vien ` will use the Python
164
- interpreter that is running ` vien ` itself. For example, if you used Python 3.9
165
- to ` pip install vien ` , then it is the Python 3.9 runs ` vien ` , and this
166
- Python 3.9 will be used in the virtual environment.
167
-
173
+ When ` create ` is called with no argument, ` vien ` will use the Python interpreter
174
+ that is running ` vien ` itself. For example, if you used Python 3.9
175
+ to ` pip install vien ` , then it is the Python 3.9 runs ` vien ` , and this Python
176
+ 3.9 will be used in the virtual environment.
168
177
169
178
# "shell" command
170
179
197
206
198
207
Now you're back.
199
208
200
- With shell pipes, you can specify what the shell should execute right in the
209
+ With shell pipes, you can specify what the shell should execute right in the
201
210
command line.
202
211
203
212
``` bash
@@ -246,10 +255,9 @@ $ vien call pkg/module.py
246
255
247
256
### "call": running file as a module
248
257
249
- If the ` .py ` file name is preceded by the ` -m ` parameter, we will run it with
250
- ` python -m MODULE ` . Running in this manner often simplifies importing other modules
251
- from the program.
252
-
258
+ If the ` .py ` file name is preceded by the ` -m ` parameter, we will run it with
259
+ ` python -m MODULE ` . Running in this manner often simplifies importing other
260
+ modules from the program.
253
261
254
262
``` bash
255
263
$ cd /abc/myProject
@@ -261,16 +269,16 @@ $ vien call -m /abc/myProject/pkg/sub/module.py
261
269
```
262
270
263
271
- ` module.py ` must be located somewhere inside the ` /abc/myProject `
264
- - parent subdirectories such as ` pkg ` and ` sub ` must be importable, i.e. must contain
272
+ - parent subdirectories such as ` pkg ` and ` sub ` must be importable, i.e. must
273
+ contain
265
274
` __init__.py `
266
- - the project directory will be inserted into ` $PYTHONPATH ` , making
275
+ - the project directory will be inserted into ` $PYTHONPATH ` , making
267
276
` pkg.sub.module ` resolvable from ` /abc/myProject ` to a file
268
-
269
- The project directory can be specified not only by the working directory,
270
- but also by the ` -p ` parameter.
271
277
278
+ The project directory can be specified not only by the working directory, but
279
+ also by the ` -p ` parameter.
272
280
273
- The ` call ` command only accepts ` .py ` files, no module names.
281
+ The ` call ` command only accepts ` .py ` files, no module names.
274
282
275
283
``` bash
276
284
# ERROR: there is no file named pkg.module
@@ -290,7 +298,7 @@ $ vien call -B -OO -m package/main.py arg1 arg2
290
298
### "call": project directory
291
299
292
300
The optional ` -p ` parameter can be specified before the ` call ` word. It allows
293
- you to set the project directory ** relative** to the parent directory of the
301
+ you to set the project directory ** relative** to the parent directory of the
294
302
** file** being run.
295
303
296
304
``` bash
@@ -320,11 +328,6 @@ $ vien -p ../.. call -m sub/module.py
320
328
# working dir: /abc/myProject/pkg
321
329
```
322
330
323
-
324
-
325
-
326
-
327
-
328
331
# "delete" command
329
332
330
333
` vien delete ` deletes the virtual environment.
@@ -364,7 +367,7 @@ vien -p /abc/myProject shell ...
364
367
365
368
If ` --project-dir ` is specified, it is the project directory.
366
369
367
- If ` --project-dir ` is not specified, then all commands assume that the current
370
+ If ` --project-dir ` is not specified, then all commands assume that the current
368
371
working directory is the project directory.
369
372
370
373
The next two calls use the same project directory and the same virtual
@@ -380,14 +383,12 @@ cd /any/where
380
383
vien -p /abc/myProject run python3 /abc/myProject/main.py
381
384
```
382
385
386
+ If ` --project-dir ` is specified as a ** relative path** , its interpretation
387
+ depends on the command.
383
388
384
-
385
- If ` --project-dir ` is specified as a ** relative path** , its interpretation depends
386
- on the command.
387
- - For the ` call ` command, this is a path relative to
388
- the parent directory of the ` .py ` file being run
389
- - For other commands, this is
390
- a path relative to the current working directory
389
+ - For the ` call ` command, this is a path relative to the parent directory of
390
+ the ` .py ` file being run
391
+ - For other commands, this is a path relative to the current working directory
391
392
392
393
# Virtual environments location
393
394
0 commit comments