You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-17Lines changed: 26 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
# compact testprogram distribution
1
+
# Compact testprogram distribution
2
2
3
3
Zipapps are a sensible way to be able to distribute test programs with reasonable dependencies.
4
4
5
-
For executing robotframework in order to perform production facility / test floor automated tasks
5
+
For executing Robot Framework in order to perform production facility / test floor automated tasks
6
6
the dependency list becomes.:
7
7
8
8
- The operating system
@@ -15,7 +15,7 @@ The only dependency is a python interpreter with a minimum version number, and t
15
15
that only zipapp compatible dependencies can be used.
16
16
17
17
For python versions 3.10 and 3.11 it is recommended to disable zipimport.zipimporter.invalidate_caches
18
-
as it has a large performance impact. Disabling it, looses the feature to modify the zipapp during
18
+
as it has a large performance impact. Disabling it, loses the feature to modify the zipapp during
19
19
runtime...
20
20
21
21
### Using pdm with pdm-packer
@@ -30,7 +30,7 @@ A python only zipapp without any native code.
30
30
```
31
31
At this point you are presented with robot output...
32
32
33
-
### Minimal Zipapp Build (a.k.a. Limbo Mode)
33
+
### Minimal zipapp build (a.k.a. Limbo Mode)
34
34
35
35
let’s reduce the size of the zipapp.:
36
36
@@ -75,39 +75,48 @@ close to the size of a python installer (28MBytes), and is a self contained, sin
75
75
76
76
cx_freeze does use script entry points.
77
77
78
-
Robotframework does come with a script, which is documented [here](https://robot-framework.readthedocs.io/en/latest/autodoc/robot.html#module-robot.run).
78
+
Robot Framework does come with a script, which is documented [here](https://robot-framework.readthedocs.io/en/latest/autodoc/robot.html#module-robot.run).
79
79
80
80
What is not documented (and as far as I understand from this [discussion](https://github.com/robotframework/robotframework/issues/5384) will not be, this
81
81
[pull request](https://github.com/robotframework/robotframework/pull/5390) was provided to remove pythonpathsetter), is that this script needs to live in
82
-
the source tree, and can not use an installed robotframework, like in the zipapp/frozenapp/etc use case.
82
+
the source tree, and can not use an installed Robot Framework, like in the zipapp/frozenapp/etc use case.
83
83
84
84
### background
85
-
It is possible to use robotframework straight from the source tree, without installation or configuring PYTHONPATH. This feature is not documented in the
85
+
It is possible to use Robot Framework straight from the source tree, without installation or configuring PYTHONPATH. This feature is not documented in the
86
86
end user documentation, and not explained in the CONTRIBUTING.rst.
87
87
88
-
This is implemented using the `pythonpathsetter` module which can be loaded by `import pythonpathsetter` when the robotframework is run from the script,
89
-
additionally by `import robot.pythonpathsetter` when the script runs inside an environment where robotframework was installed into, and only using
88
+
This is implemented using the `pythonpathsetter` module which can be loaded by `import pythonpathsetter` when the Robot Framework is run from the script,
89
+
additionally by `import robot.pythonpathsetter` when the script runs inside an environment where Robot Framework was installed into, and only using
90
90
`import robot.pythonpathsetter`. This module changes the the `sys.path` at runtime, which can cause severe confusion when debugging dependency issues.
91
91
92
92
These are the symptoms to look out for.:
93
-
1 is that robotframework fails, as pythonpathsetter can not be imported.
93
+
1 is that Robot Framework fails, as pythonpathsetter can not be imported.
94
94
2 you can use ```import robot; robot.run()``` when debugging from a REPL.
95
95
96
96
In total at the time of writing there are 34 instances of ```sys.path``` and 89 ```__file__```in the source, all of them bring the risk of causing issues
97
97
with zipapp/frozenapp usage. When I went over the source the first time, I missed how the ```pythonpathsetter``` can cause issues.
98
98
99
99
### solutions
100
100
#### make sure pythonpathsetter exits
101
-
Install a ```pythonpathsetter.py``` into your environment. Be aware future releases of robotframework will call a ```pythonpathsetter.set_pythonpath```
102
-
which is in the source tree where you would expect ```robot.pythonpathsetter.set_pythonpath```. It doesnt need to do anything but if it is missing the code
101
+
Install a ```pythonpathsetter.py``` into your environment. Be aware future releases of Robot Framework will call a ```pythonpathsetter.set_pythonpath```fucntion.
102
+
This function is in the source tree where you would expect ```robot.pythonpathsetter.set_pythonpath```. It doesn’t need to do anything but if it is missing the code
103
103
will not work. This change is introduced in response to linter messages.
104
104
105
-
#### do not use robotframework distributed scripts
105
+
#### do not use Robot Framework distributed scripts
106
106
Provide your own start script.
107
107
108
+
#### [merge](https://github.com/robotframework/robotframework/pull/5390) (would need to come from upstream)
109
+
Apart of improving the situation for frozenapp/zipapp use cases this brings these advantages.:
110
+
111
+
1) Reduction of total complexity (cyclomatic complexity goes from 18329 to 18307 a delta of 22, number of lines from 58033 to 57967, a delta of 134)
112
+
2) The ```pythonpathsetter``` feature is not advertised. It is likely that its most common use is in Robot Framework quality control.
113
+
- if that would make testing easier/faster for multiple python installations that might be worth the risk.
114
+
- solutions like [uvx](https://docs.astral.sh/uv/)```uvx --python 3.14 --from . --reinstall robot``` are available, taking care of warehousing the python versions
115
+
It is hard to get this point across, but the "unpack into a directory" distribution method is very much outdated by now.
116
+
108
117
#### do not modify the ```sys.path``` (would need to come from upstream)
109
118
Placing this code into the src directory, next to the robot directory of the source distribution. Using this code allows the robot code base to reduce
110
-
the modifications of the ```sys.path```, while keeping the feature to use robotframework straight from the source directory.
119
+
the modifications of the ```sys.path```, while keeping the feature to use Robot Framework straight from the source directory.
111
120
112
121
```python
113
122
import pathlib
@@ -118,13 +127,13 @@ if __name__ == "__main__":
118
127
with source.open() as run:
119
128
source_code = run.read()
120
129
exceptExceptionas e:
121
-
print(f"""run_rf is a tool allowing you to start robotframework from a source tree without installing anything. Exception {e} occurred.
130
+
print(f"""run_rf is a tool allowing you to start Robot Framework from a source tree without installing anything. Exception {e} occurred.
122
131
123
-
This script should not be used outside of robotframework development, and is not part of robotframework itself.""")
132
+
This script should not be used outside of Robot Framework development, and is not part of Robot Framework itself.""")
124
133
exec(source_code)
125
134
```
126
135
127
-
### consequence
136
+
### conclusion
128
137
There are alternatives available.
129
138
130
139
- docker (way more heavy weight, user rights need to be managed)
0 commit comments