Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
calculate_python_expression [2026/08/18 20:28] hermann |
calculate_python_expression [2026/08/18 20:55] (current) hermann |
||
|---|---|---|---|
| Line 75: | Line 75: | ||
| Packages can be installed in two ways: calling ''dinamica.package(...)'' from within the expression, or listing package names on the //packages// input port. The two differ in timing: ''dinamica.package(...)'' runs **during** the expression, so it can be called conditionally; the //packages// port always runs **before** the expression executes. | Packages can be installed in two ways: calling ''dinamica.package(...)'' from within the expression, or listing package names on the //packages// input port. The two differ in timing: ''dinamica.package(...)'' runs **during** the expression, so it can be called conditionally; the //packages// port always runs **before** the expression executes. | ||
| - | == dinamica.package() == | + | **dinamica.package()** |
| ''dinamica.package(packageName, installPath=None, loadPath=None)'' installs (if needed via pip) and imports the requested module. Because it runs together with the script, it may fail if a package is already loaded in an incompatible version. | ''dinamica.package(packageName, installPath=None, loadPath=None)'' installs (if needed via pip) and imports the requested module. Because it runs together with the script, it may fail if a package is already loaded in an incompatible version. | ||
| Line 111: | Line 111: | ||
| </code> | </code> | ||
| - | == The packages port == | + | **The packages port** |
| The //packages// input port takes one package identifier per line, in any form accepted by ''pip''. Every listed package is installed before the expression runs. Unlike ''dinamica.package()'', the port only installs — it does not also import the module, and it does not support specifying a separate install name and import name. The expression must still import each package itself, using its actual importable name (which may differ from the name given to ''pip''). | The //packages// input port takes one package identifier per line, in any form accepted by ''pip''. Every listed package is installed before the expression runs. Unlike ''dinamica.package()'', the port only installs — it does not also import the module, and it does not support specifying a separate install name and import name. The expression must still import each package itself, using its actual importable name (which may differ from the name given to ''pip''). | ||