ewoksorange merge requestshttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests2024-02-06T17:37:45+01:00https://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 Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/144fix parameter form callback bug2023-09-18T16:29:04+02:00Wout De Nolffix parameter form callback bugWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/143Release2023-09-08T10:22:13+02:00Wout De NolfReleaseWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/142bump version2023-09-08T10:00:08+02:00Wout De Nolfbump versionWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/141Remove pyqt5 from basic requirements2023-08-23T15:48:25+02:00paynoRemove pyqt5 from basic requirementsThis prevent from using another binding and bring conflict with conda pyqt for a conda installation.This prevent from using another binding and bring conflict with conda pyqt for a conda installation.paynopaynohttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/140optional defaults for get_default_input_values2023-08-24T08:56:58+02:00Wout De Nolfoptional defaults for get_default_input_valuesWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/139refer to the template project on how to implement orange addons2023-07-27T06:57:46+02:00Wout De Nolfrefer to the template project on how to implement orange addonsThe docs on how to implement Orange addons was not working (user tried and failed).
Move those docs to a template project.The docs on how to implement Orange addons was not working (user tried and failed).
Move those docs to a template project.Wout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/138Draft: Resolve "ParameterForm derived class should be able to add widgets for...2023-09-08T10:19:12+02:00Wout De NolfDraft: Resolve "ParameterForm derived class should be able to add widgets for types"Closes #24Closes #24Wout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/137Fix type of inputs in execute_task2023-06-13T16:30:33+02:00Loic HuderFix type of inputs in execute_taskAs far as I know, we use `inputs` as a `Mapping` and never as a `List`.As far as I know, we use `inputs` as a `Mapping` and never as a `List`.https://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/136bump version2023-05-15T18:47:12+02:00Wout De Nolfbump versionWout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/135deprecated ewokscore API2023-05-15T17:54:05+02:00Wout De Nolfdeprecated ewokscore APINeeds https://gitlab.esrf.fr/workflow/ewoks/ewokscore/-/merge_requests/193Needs https://gitlab.esrf.fr/workflow/ewoks/ewokscore/-/merge_requests/193Wout De NolfWout De Nolfhttps://gitlab.esrf.fr/workflow/ewoks/ewoksorange/-/merge_requests/134sphinx setuptools integration deprecated2023-04-30T13:28:14+02:00Wout De Nolfsphinx setuptools integration deprecated