Skip to content

Commit 21e4de0

Browse files
committed
Add venv support documentation and related images
1 parent 0ec1634 commit 21e4de0

File tree

7 files changed

+84
-4
lines changed

7 files changed

+84
-4
lines changed

docs/img/3.11.png

330 KB
Loading

docs/img/3.12.png

363 KB
Loading

docs/img/bigpicture.png

216 KB
Loading

docs/img/trace.png

311 KB
Loading

docs/img/venv3.11-config.png

164 KB
Loading

docs/venv.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# venv support
2+
3+
![img](./img/bigpicture.png)
4+
5+
How to set up a virtual environment for the Iris IOP framework.
6+
7+
>! Note: This is a proof-of-concept and not a production-ready solution.
8+
9+
## How everything is set up
10+
11+
The source code are migrated to iris thanks to the `iop --migrate` command.
12+
13+
Both virtual environments are created using the vanilla `python -m venv` command.
14+
15+
The `iop` command is used to run the source code **in the virtual environments.**
16+
17+
```bash
18+
# activate the secondary virtual environment
19+
source /opt/irisapp/.venv3.11/bin/activate
20+
21+
# migrate the source code
22+
iop -m /irisdev/app/src/python/other/settings.py
23+
24+
# deactivate the secondary virtual environment
25+
deactivate
26+
27+
# activate the main virtual environment
28+
source /opt/irisapp/.venv/bin/activate
29+
30+
# migrate the source code
31+
iop -m /irisdev/app/src/python/reddit/settings.py
32+
33+
# start production
34+
iop --start dc.Python.Production
35+
```
36+
37+
>! Note: if deploying code in a non-venv environment, the parameters `%PythonPath` won't be set, and the code will run in the default python environment.
38+
39+
## Virtual Manual configuration
40+
41+
The parameters :
42+
43+
- `%PythonPath` : the path to the python lib in the virtual environment
44+
- `%PythonRuntimeLibraryVersion` : the version of python used in the virtual environment
45+
- `%PythonRuntimeLibrary` : the path to the lib python in the virtual environment
46+
47+
![img](./img/venv3.11-config.png)
48+
49+
## Full example
50+
51+
See the full example in the [iris-venv-demo](https://github.com/grongierisc/iris-venv-test).
52+
53+
### How it works
54+
55+
As the interoperability framework works with independent processes, it's manageable to run each process in its own virtual environment.
56+
57+
This allows for easy management of dependencies and versions.
58+
59+
For this demo, we will be using two virtual environments:
60+
61+
- `.venv`
62+
- This is the main virtual environment that will run source code in `./src/python/reddit`
63+
- It will use it's own dependencies in `./src/python/reddit/requirements.txt`
64+
- `requests`
65+
- `dataclasses-json`
66+
- The version of python will be `3.12`
67+
- The venv folder will be in `/opt/irisapp/.venv/`
68+
- `.venv3.11`
69+
- This is a secondary virtual environment that will run source code in `./src/python/other`
70+
- It will use it's own dependencies in `./src/python/other/requirements.txt`
71+
- `deepdiff`
72+
- The version of python will be `3.11`
73+
- The venv folder will be in `/opt/irisapp/.venv3.11/`
74+
75+
### Screenshots
76+
77+
![img](./img/3.11.png)
78+
![img](./img/3.12.png)
79+
![img](./img/trace.png)

mkdocs.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ nav:
1212
- API documentation:
1313
- Command Line Interface: command-line.md
1414
- Python API: python-api.md
15-
- DTL Support: dtl.md
16-
- Logging: logging.md
17-
- Debugging: debug.md
18-
- Production Settings: prod-settings.md
15+
- DTL Support: dtl.md
16+
- Logging: logging.md
17+
- Debugging: debug.md
18+
- Production Settings: prod-settings.md
19+
- Venv Support: venv.md
1920
- Contributing:
2021
- Contributing: contributing.md
2122
- Code of Conduct: code-of-conduct.md

0 commit comments

Comments
 (0)