Skip to content

Commit 6c6c632

Browse files
committed
docs
1 parent 7b94bf1 commit 6c6c632

File tree

1 file changed

+41
-40
lines changed

1 file changed

+41
-40
lines changed

README.md

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -117,26 +117,23 @@ $ vien call main.py
117117

118118
# "create" command
119119

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`
122122
with the same project directory will use the same virtual environment.
123123

124124
``` bash
125125
$ cd /abc/myProject
126126
$ vien create
127127
```
128128

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

134132
``` bash
135133
$ vien -p /abc/myProject create
136134
```
137135

138-
139-
The `-p` parameter works with all commands, not just `create`.
136+
The `-p` argument works with all commands, not only `create`.
140137

141138
``` bash
142139
$ cd /other/working/dir
@@ -146,8 +143,21 @@ $ vien -p /abc/myProject shell
146143

147144
### "create": choose the Python version
148145

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

152162
``` bash
153163
$ 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
160170
$ vien create python3.8
161171
```
162172

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

169178
# "shell" command
170179

@@ -197,7 +206,7 @@ $ _
197206

198207
Now you're back.
199208

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
201210
command line.
202211

203212
``` bash
@@ -246,10 +255,9 @@ $ vien call pkg/module.py
246255

247256
### "call": running file as a module
248257

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

254262
``` bash
255263
$ cd /abc/myProject
@@ -261,16 +269,16 @@ $ vien call -m /abc/myProject/pkg/sub/module.py
261269
```
262270

263271
- `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
265274
`__init__.py`
266-
- the project directory will be inserted into `$PYTHONPATH`, making
275+
- the project directory will be inserted into `$PYTHONPATH`, making
267276
`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.
271277

278+
The project directory can be specified not only by the working directory, but
279+
also by the `-p` parameter.
272280

273-
The `call` command only accepts `.py` files, no module names.
281+
The `call` command only accepts `.py` files, no module names.
274282

275283
``` bash
276284
# ERROR: there is no file named pkg.module
@@ -290,7 +298,7 @@ $ vien call -B -OO -m package/main.py arg1 arg2
290298
### "call": project directory
291299

292300
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
294302
**file** being run.
295303

296304
``` bash
@@ -320,11 +328,6 @@ $ vien -p ../.. call -m sub/module.py
320328
# working dir: /abc/myProject/pkg
321329
```
322330

323-
324-
325-
326-
327-
328331
# "delete" command
329332

330333
`vien delete` deletes the virtual environment.
@@ -364,7 +367,7 @@ vien -p /abc/myProject shell ...
364367

365368
If `--project-dir` is specified, it is the project directory.
366369

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
368371
working directory is the project directory.
369372

370373
The next two calls use the same project directory and the same virtual
@@ -380,14 +383,12 @@ cd /any/where
380383
vien -p /abc/myProject run python3 /abc/myProject/main.py
381384
```
382385

386+
If `--project-dir` is specified as a **relative path**, its interpretation
387+
depends on the command.
383388

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
391392

392393
# Virtual environments location
393394

0 commit comments

Comments
 (0)