diff --git a/condarecipe/larray-editor/meta.yaml b/condarecipe/larray-editor/meta.yaml index d01ea32..1035ab3 100644 --- a/condarecipe/larray-editor/meta.yaml +++ b/condarecipe/larray-editor/meta.yaml @@ -22,12 +22,13 @@ requirements: run: - python >=3.9 - # Technically, we should require larray >=0.35 because we need align_arrays - # for compare(), but to make larray-editor releasable, we cannot depend on - # larray X.Y when releasing larray-editor X.Y (see utils.py for more - # details) - # TODO: require 0.35 for next larray-editor version - - larray >=0.32 + # We often require new functionality in larray X.Y for larray-editor X.Y + # because we develop both in parallel, but currently we CANNOT require + # larray >=X.Y for larray-editor X.Y because larray-editor X.Y must be + # released before larray X.Y (to include its changelog) so we need to + # vendor new larray features in larray-editor and only require + # larray >=X.Y-1 + - larray >=0.35 # it is indirectly pulled from larray, but let us be explicit about this - numpy >=1.22 - matplotlib diff --git a/doc/source/changes/version_0_35_1.rst.inc b/doc/source/changes/version_0_35_1.rst.inc index 995c222..0066145 100644 --- a/doc/source/changes/version_0_35_1.rst.inc +++ b/doc/source/changes/version_0_35_1.rst.inc @@ -66,6 +66,9 @@ Fixes relative difference" label were always wrong and the comparison failed completely when the first array was an object array containing any 0 value. +* do not try to display Path objects which point to a file or directory which + does not exist (closes :editor_issue:`317`). + * fixed the mechanism writing warning/error messages happening during the editor initialization. The errors are now correctly written in the user TEMP directory / larray-editor-stderr.log \ No newline at end of file diff --git a/larray_editor/arrayadapter.py b/larray_editor/arrayadapter.py index 52cc0fc..1a0a34a 100644 --- a/larray_editor/arrayadapter.py +++ b/larray_editor/arrayadapter.py @@ -1095,6 +1095,8 @@ def cell_activated(self, row_idx, column_idx): @adapter_for('pathlib.Path') def get_path_suffix_adapter(fpath): logger.debug(f"get_path_suffix_adapter('{fpath}')") + if not fpath.exists(): + return f"Path '{fpath}' does not exist" suffix = fpath.suffix.lower() if suffix in PATH_SUFFIX_ADAPTERS: path_adapter_cls, required_module = PATH_SUFFIX_ADAPTERS[suffix] diff --git a/larray_editor/comparator.py b/larray_editor/comparator.py index 6ea10de..40e40f9 100644 --- a/larray_editor/comparator.py +++ b/larray_editor/comparator.py @@ -1,13 +1,14 @@ import numpy as np -import larray as la import pandas as pd +import larray as la +from larray.core.array import align_arrays from qtpy.QtCore import Qt from qtpy.QtWidgets import (QWidget, QVBoxLayout, QListWidget, QSplitter, QHBoxLayout, QLabel, QCheckBox, QLineEdit, QComboBox, QMessageBox) from larray_editor.arrayadapter import ensure_numeric_array -from larray_editor.utils import _, print_exception, align_arrays +from larray_editor.utils import _, print_exception from larray_editor.arraywidget import ArrayEditorWidget from larray_editor.editor import AbstractEditorWindow diff --git a/larray_editor/utils.py b/larray_editor/utils.py index dcb8f41..ec1b693 100644 --- a/larray_editor/utils.py +++ b/larray_editor/utils.py @@ -37,30 +37,6 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar from larray.util.misc import Product -try: - from larray.core.array import align_arrays -except ImportError: - # TODO: remove this when we release any version of larray-editor > 0.35.0 - # and require larray >= 0.35 - # This function is necessary *only* for larray-editor version - # 0.35.ZERO. Because of the incorporation of the larray-editor changelog in - # the larray release, we cannot depend on larray >= 0.35 when releasing - # larray-editor 0.35.0 (which is very silly because we develop both in - # parallel) - def align_arrays(arrays, join='outer', fill_value=np.nan): - if len(arrays) > 2: - raise NotImplementedError("aligning more than two arrays requires " - "larray >= 0.35") - first_array = arrays[0] - - def is_raw(array): - return all(axis.iswildcard and axis.name is None - for axis in array.axes) - - if all(is_raw(array) and array.shape == first_array.shape - for array in arrays[1:]): - return arrays - return first_array.align(arrays[1], join=join, fill_value=fill_value) # field is field_name + conversion if any M_SPECIFIER_PATTERN = re.compile(r'\{(?P[^:}]*):(?P[^m}]*)m\}') diff --git a/pyproject.toml b/pyproject.toml index 5df7622..b3dfba5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,13 +40,13 @@ dependencies = [ # jedi >=0.18 to workaround incompatibility between jedi <0.18 and # parso >=0.8 (see #220) "jedi >=0.18", - # Technically, we should require larray >=0.35 because we need align_arrays - # for compare(), but to make larray-editor releasable, we cannot depend on - # larray X.Y when releasing larray-editor X.Y (see utils.py for more - # details) - # TODO: require 0.35 for next larray-editor version and drop shim in - # utils.pyk - "larray >=0.32", + # We often require new functionality in larray X.Y for larray-editor X.Y + # because we develop both in parallel, but currently we CANNOT require + # larray >=X.Y for larray-editor X.Y because larray-editor X.Y must be + # released before larray X.Y (to include its changelog) so we need to + # vendor new larray features in larray-editor and only require + # larray >=X.Y-1 + "larray >=0.35", "matplotlib", "numpy", # Pandas is required directly for a silly reason (to support converting @@ -55,7 +55,7 @@ dependencies = [ # indirectly required via larray, it does not really matter. "pandas", # we do not actually require PyQt6 but rather either PyQt5, PyQt6 or - # PySide6 but I do not know how to specify this + # PySide6, but I do not know how to specify this "PyQt6", "qtpy" ]