Skip to content

Commit f743eb8

Browse files
Merge 825fa9a into master
2 parents 8273822 + 825fa9a commit f743eb8

File tree

2 files changed

+44
-35
lines changed

2 files changed

+44
-35
lines changed

README.md

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,17 @@ $ cd /path/to/myProject
217217
$ vien call main.py
218218
```
219219

220-
The optional `-p` parameter allows you to specify the project directory
221-
**relative** to the parent directory of the **file** being run.
220+
In fact, all arguments following the `call` command are passed directly to the
221+
python executable.
222+
223+
``` bash
224+
# passing arguments [-B, -OO] to Python and [arg1, arg2] to main.py
225+
$ vien call -B -OO main.py arg1 arg2
226+
```
227+
228+
The optional `-p` parameter can be specified before the `call` word. It allows
229+
you to set the project directory **relative** to the parent directory of the **
230+
file** being run.
222231

223232
``` bash
224233
$ cd any/where # working dir is irrelevant
@@ -318,6 +327,37 @@ in `/x/y/z/aaa_venv`.
318327

319328
The `_venv` suffix tells the utility that this directory can be safely removed.
320329

330+
# Shebang
331+
332+
On POSIX systems, you can make a `.py` file executable, with `vien` executing it
333+
inside a virtual environment.
334+
335+
Insert the shebang line to the top of the file you want to run. The value of the
336+
shebang depends on the location of the file relative to the project directory.
337+
338+
File | Shebang line
339+
--------------------------------|--------------------------------
340+
`myProject/runme.py` | `#!/usr/bin/env vien -p . call`
341+
`myProject/pkg/runme.py` | `#!/usr/bin/env vien -p .. call`
342+
`myProject/pkg/subpkg/runme.py` | `#!/usr/bin/env vien -p ../.. call`
343+
344+
After inserting the shebang, make the file executable:
345+
346+
``` bash
347+
$ chmod +x runme.py
348+
```
349+
350+
Now you can run the `runme.py` directly from command line. This will use the
351+
virtual environment associated with the `myProject`. The working directory can
352+
be anything.
353+
354+
``` bash
355+
# runs the runme.py in virtual environment for myProject
356+
357+
$ cd anywhere/somewhere
358+
$ /abc/myProject/pkg/main.py
359+
```
360+
321361
# Shell prompt
322362

323363
By default the `vien shell` adds a prefix to
@@ -352,35 +392,4 @@ personalized:prompt> PS1=$PS1 vien shell
352392
```
353393

354394
To avoid doing this each time, `export` your `PS1` to make it available for
355-
subprocesses.
356-
357-
# Shebang
358-
359-
On POSIX systems, you can make a `.py` file executable, with `vien` executing it
360-
inside a virtual environment.
361-
362-
Insert the shebang line to the top of the file you want to run. The value of the
363-
shebang depends on the location of the file relative to the project directory.
364-
365-
File | Shebang line
366-
--------------------------------|--------------------------------
367-
`myProject/runme.py` | `#!/usr/bin/env vien -p . call`
368-
`myProject/pkg/runme.py` | `#!/usr/bin/env vien -p .. call`
369-
`myProject/pkg/subpkg/runme.py` | `#!/usr/bin/env vien -p ../.. call`
370-
371-
After inserting the shebang, make the file executable:
372-
373-
``` bash
374-
$ chmod +x runme.py
375-
```
376-
377-
Now you can run the `runme.py` directly from command line. This will use the
378-
virtual environment associated with the `myProject`. The working directory can
379-
be anything.
380-
381-
``` bash
382-
# runs the runme.py in virtual environment for myProject
383-
384-
$ cd anywhere/somewhere
385-
$ /abc/myProject/pkg/main.py
386-
```
395+
subprocesses.

vien/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = "5.0.1"
1+
__version__ = "5.0.2"
22
__copyright__ = "(c) 2020-2021 Artëm IG <github.com/rtmigo>"
33
__license__ = "BSD-3-Clause"

0 commit comments

Comments
 (0)