@@ -231,14 +231,21 @@ from the program.
231
231
232
232
``` bash
233
233
$ cd /abc/myProject
234
- $ vien call -m /abc/myProject/pkg/module.py
234
+ $ vien call -m /abc/myProject/pkg/sub/ module.py
235
235
236
- # runs [python -m pkg.module]
236
+ # runs [python -m pkg.sub.module]
237
+ # project dir: /abc/myProject
238
+ # working dir: /abc/myProject
237
239
```
238
240
239
241
- ` module.py ` must be located somewhere inside the ` /abc/myProject `
240
- - parent subdirectories such as ` pkg ` must be importable, i.e. must contain
241
- ` pkg/__init__.py `
242
+ - parent subdirectories such as ` pkg ` an ` sub ` must be importable, i.e. must contain
243
+ ` __init__.py `
244
+ - the project directory will be inserted into ` $PYTHONPATH ` making the module
245
+ visible
246
+
247
+ The project directory can be specified not only by the working directory,
248
+ but also by the ` -p ` parameter.
242
249
243
250
244
251
The ` call ` command only accepts ` .py ` files, no module names.
@@ -264,18 +271,37 @@ The optional `-p` parameter can be specified before the `call` word. It allows
264
271
you to set the project directory ** relative** to the parent directory of the
265
272
** file** being run.
266
273
267
- ``` bash
268
- $ cd any/where # working dir is irrelevant
274
+ ``` bash
275
+ $ cd /far/away
276
+ $ vien -p /abc/myProject call -m /abc/myProject/pkg/sub/module.py
277
+
278
+ # runs [python -m pkg.sub.module]
279
+ # project dir: /abc/myProject
280
+ # working dir: /far/away
281
+ ```
282
+
283
+ ``` bash
284
+ $ cd /far/away
285
+ $ vien -p ../.. call -m /abc/myProject/pkg/sub/module.py
269
286
270
- # both of the following calls will use
271
- # /abc/myProject as the project directory
287
+ # runs [python -m pkg.sub.module]
288
+ # project dir: /abc/myProject (/abc/myProject/pkg/sub/../..)
289
+ # working dir: /far/away
290
+ ```
291
+
292
+ ``` bash
293
+ $ cd /abc/myProject/pkg
294
+ $ vien -p ../.. call -m sub/module.py
272
295
273
- $ vien -p /abc/myProject call /abc/myProject/pkg/main.py
274
- $ vien -p .. call /abc/myProject/pkg/main.py
296
+ # runs [python -m pkg.sub.module]
297
+ # project dir: /abc/myProject (/abc/myProject/pkg/sub/../..)
298
+ # working dir: /abc/myProject/pkg
275
299
```
276
300
277
- In the second case ` .. ` means that the project directory is
278
- ` /abc/myProject/pkg/.. ` , which resolves to ` /abc/myProject ` .
301
+
302
+
303
+
304
+
279
305
280
306
# "delete" command
281
307
0 commit comments