ewoksorange merge requestshttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests2024-03-26T08:50:19+01:00https://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/164Fix get_default_input_value in OWEwoksBaseWidget2024-03-26T08:50:19+01:00Loic HuderFix get_default_input_value in OWEwoksBaseWidgetCalling `get_default_input_value` failed since `dict.get` does not allow keyword arguments:
```
>>> d = dict()
>>> d.get("a", default=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: dict.get() take...Calling `get_default_input_value` failed since `dict.get` does not allow keyword arguments:
```
>>> d = dict()
>>> d.get("a", default=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: dict.get() takes no keyword arguments
```Loic HuderLoic Huderhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/163ignore gc warnings2024-03-19T13:32:14+01:00Wout De Nolfignore gc warningsWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/162bump version2024-03-18T14:14:55+01:00Wout De Nolfbump versionWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/161custom ewoks configuration for orange to skip ewokstest entry points when not...2024-03-18T13:53:50+01:00Wout De Nolfcustom ewoks configuration for orange to skip ewokstest entry points when not enabledWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/160Support 3.10 and 3.112024-02-13T20:17:05+01:00Wout De NolfSupport 3.10 and 3.11Wout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/159Resolve "Ewoks task creation exceptions should be visible when using the trig...2024-03-01T12:06:53+01:00Wout De NolfResolve "Ewoks task creation exceptions should be visible when using the trigger or execute button"Closes #35Closes #35Wout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/158Bump to 0.6.02024-02-20T10:55:39+01:00Loic HuderBump to 0.6.0Can wait for a bit if you want to have other stuff merged in.Can wait for a bit if you want to have other stuff merged in.https://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/157Draft: Log an error instead of info if task creation failed in TaskExecutor2024-02-13T18:55:51+01:00Loic HuderDraft: Log an error instead of info if task creation failed in TaskExecutorBy default, `INFO` logs are not shown by `ewoks-canvas` so this error can pass undetected.By default, `INFO` logs are not shown by `ewoks-canvas` so this error can pass undetected.https://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/156Add data_viewer widget2024-02-12T13:13:23+01:00Loic HuderAdd data_viewer widgetCopied from `ewoksfluo`.
See https://gitlab.esrf.fr/workflow/ewoksapps/ewoksfluo/-/merge_requests/22 for the original implementation and motivation.Copied from `ewoksfluo`.
See https://gitlab.esrf.fr/workflow/ewoksapps/ewoksfluo/-/merge_requests/22 for the original implementation and motivation.https://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/155re-raise workflow errors when running an orange workflow with Qt triggering2024-02-20T10:38:42+01:00Wout De Nolfre-raise workflow errors when running an orange workflow with Qt triggeringThe same as https://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/153 but now not for individual widgets but entire workflows.
FYI the class `OrangeCanvasHandler` ("Run orange widget-based workflow manually (i.e. without ex...The same as https://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/153 but now not for individual widgets but entire workflows.
FYI the class `OrangeCanvasHandler` ("Run orange widget-based workflow manually (i.e. without executing the Qt application)") is currently only used in tests.Wout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/154bump version2024-02-06T13:51:19+01:00Wout De Nolfbump versionWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/153Fix widget testing2024-02-06T17:37:45+01:00Wout De NolfFix widget testingEwoks task widgets are tested by running `execute_task`. This method failed to re-raise task execution or post execution failures.
In addition the custom QEvent never times out, causing `execute_task` failures to hang the CI: https://gi...Ewoks task widgets are tested by running `execute_task`. This method failed to re-raise task execution or post execution failures.
In addition the custom QEvent never times out, causing `execute_task` failures to hang the CI: https://gitlab.esrf.fr/workflow/ewoksapps/ewoksfluo/-/jobs/941261Wout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/152Handle deprecated pkg_resources2024-03-18T09:53:10+01:00Wout De NolfHandle deprecated pkg_resourcesProper fix for https://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/issues/32
* remove upper version bounds for `orange-canvas-core` and `orange-widget-base`
* replace deprecated `importlib.resources.path` usage with `importlib.resources...Proper fix for https://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/issues/32
* remove upper version bounds for `orange-canvas-core` and `orange-widget-base`
* replace deprecated `importlib.resources.path` usage with `importlib.resources.files`
* replace deprecated `pkg_resources` usage (the two orange base projects did this as well, Orange3 itself too but not released yet)
* without `pkg_resources` it is very hard to support runtime injection of Orange add-ons. Since we only used this for the tests, I replaced this with a static `ewokstest` module in `orangecontrib` which is not visible by default but is enabled in a pytest fixture or when doing `ewoks-canvas ... --with-examples`.
* implicit orangecontrib namespace package (PEP 420). This can be done for all add-ons as well (est, ewoksxrpd, tomwer, darfix, ...)
* `widget_discovery` helper function for add-ons that want to handle `pkg_resources` vs. `importlib` as well
* `Oasys` is pinning all kinds of old versions with lots of deprecation warnings. Not worth it so disable warning raising in CI.
* ignore deprecation warnings in external dependencies (next releases of `silx` and `Orange3` will fix those)
Some more details below:
# Removing runtime injection of Orange add-ons
Without `pkg_resources` it becomes too complicated to manage orange addons that are injected at runtime.
https://stackoverflow.com/questions/57126085/how-to-use-sys-meta-path-with-python-3-x
https://github.com/python/importlib_metadata/issues/427
I tried but failed and even if we could make it work, this is very hacky and would be a hell to maintain.
So I removed support for runtime injection of Orange add-ons and replace it by adding `ewokstest` which by default has a `widget_discovery` that does returns nothing so the category is not visible in the canvas.
TODO: Removing support for runtime injection of Orange add-ons gets rid of lots of tricky code so that's a good thing. However currently you see an error log when `ewokstest` is not enabled (which is the default) when selecting a tutorial/example workflow on the canvas. It doesn't hurt but it looks bad. Not sure how to disable tutorials in another way than raising an exception. An alternative would be to hack the distribution object and remove tutorial/example entry points. We do not want the `ewokstest` examples to show up when `--with-examples` is not set.
```
2024-03-17 13:57:06,038:ERROR:orangecanvas.application.examples: Could not load examples from <importlib.metadata.PathDistribution object at 0x71240ffbded0>
Traceback (most recent call last):
File "/home/denolf/virtualenvs/ewoks/lib/python3.10/site-packages/orangecanvas/application/examples.py", line 53, in workflows
examples = ep.load()
File "/home/denolf/.pyenv/versions/3.10.13/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
module = import_module(match.group('module'))
File "/home/denolf/.pyenv/versions/3.10.13/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/denolf/projects/ewoksorange/src/orangecontrib/ewokstest/tutorials/__init__.py", line 6, in <module>
raise RuntimeError("ewokstest is disabled")
RuntimeError: ewokstest is disabled
```
The code that captures and prints the error is in `orange-canvas-core`
```python
def workflows(config=None):
# type: (Optional[_config.Config]) -> List[ExampleWorkflow]
"""
Return all known example workflows.
"""
if config is None:
config = _config.default
workflows = [] # type: List[ExampleWorkflow]
if hasattr(config, "tutorials_entry_points") and \
callable(config.tutorials_entry_points):
# back compatibility
examples_entry_points = config.tutorials_entry_points
else:
examples_entry_points = config.examples_entry_points
for ep in examples_entry_points():
try:
examples = ep.load()
except Exception:
log.error("Could not load examples from %r",
ep.dist, exc_info=True)
continue
```
# `widget_discovery` in ewoks apps
`ewoksorange` provides a helper method which needs to be used in projects like `est`, `tomwer` and other packages in which we want to remove the usage of the deprecated `pkg_resources`, depending on the orange version.
For example in `est` this
```python
def widget_discovery(discovery):
import pkg_resources
dist = pkg_resources.get_distribution("est")
pkgs = [
"orangecontrib.est.widgets.pymca",
"orangecontrib.est.widgets.larch",
"orangecontrib.est.widgets.utils",
]
for pkg in pkgs:
discovery.process_category_package(pkg, distribution=dist)
```
becomes this
```python
# Entry point for main Orange categories/widgets discovery
def widget_discovery(discovery):
from ewoksorange.discovery import widget_discovery
modules = [
"orangecontrib.est.widgets.pymca",
"orangecontrib.est.widgets.larch",
"orangecontrib.est.widgets.utils",
]
widget_discovery(discovery, "est", modules)
```
# `orangecontrib` namespace package
This
```python
# src/orangecontrib/__init__.py
__import__("pkg_resources").declare_namespace(__name__)
```
together with this
```
# setup.cfg
[options]
packages=find:
namespace_packages =
orangecontrib
```
is deprecated (see [setuptools docs](https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages)). It can be replaced by implicit namespace packages (as specified in PEP 420).
```
# setup.cfg
[options]
packages=find_namespace:
```
In addition `src/orangecontrib/__init__.py` is removed.
The same thing could be done for all orange add-ons.Wout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/151Resolve "Orange release breaks ewoksdemo"2023-12-15T14:51:13+01:00Wout De NolfResolve "Orange release breaks ewoksdemo"Closes #32Closes #32Wout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/150Allow hidding some ewoks input and / or output to Orange2023-12-08T09:23:43+01:00paynoAllow hidding some ewoks input and / or output to Orangeclose #31
# result
interface before the PR![Screenshot_from_2023-11-20_09-36-08](/uploads/629c770383d98c38a9ef0b245e53a273/Screenshot_from_2023-11-20_09-36-08.png)
interface after the PR and adding the following to the widget
```
cla...close #31
# result
interface before the PR![Screenshot_from_2023-11-20_09-36-08](/uploads/629c770383d98c38a9ef0b245e53a273/Screenshot_from_2023-11-20_09-36-08.png)
interface after the PR and adding the following to the widget
```
class MyEwoksOrangeWidget:
...
_ewoks_inputs_to_hide_from_orange = (
"__process__",
"raw_projections_required",
"raw_projections_each",
"raw_darks_required",
"raw_flats_required",
)
```
![Screenshot_from_2023-11-20_10-37-21](/uploads/e1b41bc891b0ddd22ebfc978dbed608e/Screenshot_from_2023-11-20_10-37-21.png)paynopaynohttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/149bump version2023-10-03T11:26:41+02:00Wout De Nolfbump versionWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/148keep reference to default control buttons2023-10-03T10:00:04+02:00Wout De Nolfkeep reference to default control buttonsWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/147Release2023-10-03T09:28:16+02:00Wout De NolfReleaseWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/146homogenize API for default inputs, dynamic inputs, task inputs, task outputs2023-10-03T08:57:52+02:00Wout De Nolfhomogenize API for default inputs, dynamic inputs, task inputs, task outputsThis change was prompted by https://gitlab.esrf.fr/XRD/darfix/-/issues/92 and a user who tried to do something similar
* set a single value
* set_default_input
* set_dynamic_input
* get a single value
* get_default_input_value
*...This change was prompted by https://gitlab.esrf.fr/XRD/darfix/-/issues/92 and a user who tried to do something similar
* set a single value
* set_default_input
* set_dynamic_input
* get a single value
* get_default_input_value
* get_dynamic_input_value
* get_task_output_value
* get_task_input_value
* get variable names
* get_default_input_names
* get_dynamic_input_names
* get_input_names
* get_output_names
* set multiple values
* update_default_inputs
* update_dynamic_inputs
* get multiple values
* get_default_input_values
* get_dynamic_input_values
* get_task_output_values
* get_task_input_valuesWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/145bump version2023-09-18T17:01:34+02:00Wout De Nolfbump versionWout De NolfWout De Nolf