Skip to content

0.34.5 #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions doc/source/changes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Change log
##########

Version 0.34.5
==============

In development.

.. include:: ./changes/version_0_34_5.rst.inc


Version 0.34.3
==============

Expand Down
10 changes: 10 additions & 0 deletions doc/source/changes/version_0_34_5.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. py:currentmodule:: larray_editor

Fixes
^^^^^

* fixed console plots when xlwings 0.31.4+ is installed (closes :editor_issue:`278`).

* fixed some inplace modifications on arrays done via in the console not refreshing
the displayed array automatically and/or not adding a `*` to the window title
to inform the session is modified (closes :editor_issue:`22` and :editor_issue:`280`).
2 changes: 1 addition & 1 deletion larray_editor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from larray_editor.api import * # noqa: F403

__version__ = '0.34.3'
__version__ = '0.34.5-dev'
29 changes: 17 additions & 12 deletions larray_editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@
asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())

import matplotlib
# explicitly request Qt backend (fixes #278)
matplotlib.use('QtAgg')
import matplotlib.axes
import numpy as np

import larray as la

from larray_editor.traceback_tools import StackSummary
from larray_editor.utils import (_, create_action, show_figure, ima, commonpath, dependencies,
get_versions, get_documentation_url, urls, RecentlyUsedList)
from larray_editor.utils import (_, create_action, show_figure, ima, commonpath, DEPENDENCIES,
get_versions, get_documentation_url, URLS, RecentlyUsedList)
from larray_editor.arraywidget import ArrayEditorWidget
from larray_editor.commands import EditSessionArrayCommand, EditCurrentArrayCommand

Expand Down Expand Up @@ -75,7 +77,7 @@
REOPEN_LAST_FILE = object()

assignment_pattern = re.compile(r'[^\[\]]+[^=]=[^=].+')
setitem_pattern = re.compile(r'(\w+)(\.i|\.iflat|\.points|\.ipoints)?\[.+\][^=]=[^=].+')
setitem_pattern = re.compile(r'(\w+)(\.i|\.iflat|\.points|\.ipoints)?\[.+\][^=]*=[^=].+')
history_vars_pattern = re.compile(r'_i?\d+')
# XXX: add all scalars except strings (from numpy or plain Python)?
# (long) strings are not handled correctly so should NOT be in this list
Expand Down Expand Up @@ -234,11 +236,11 @@ def _report_issue(*args, **kwargs):
* Python {python} on {system} {bitness:d}bits
"""
issue_template += f"* {package} {{{package}}}\n"
for dep in dependencies[package]:
for dep in DEPENDENCIES[package]:
issue_template += f"* {dep} {{{dep}}}\n"
issue_template = issue_template.format(**versions)

url = QUrl(urls[f'new_issue_{package}'])
url = QUrl(URLS[f'new_issue_{package}'])
from qtpy.QtCore import QUrlQuery
query = QUrlQuery()
query.addQueryItem("body", quote(issue_template))
Expand All @@ -248,15 +250,15 @@ def _report_issue(*args, **kwargs):
return _report_issue

def open_users_group(self):
QDesktopServices.openUrl(QUrl(urls['users_group']))
QDesktopServices.openUrl(QUrl(URLS['users_group']))

def open_announce_group(self):
QDesktopServices.openUrl(QUrl(urls['announce_group']))
QDesktopServices.openUrl(QUrl(URLS['announce_group']))

def about(self):
"""About Editor"""
kwargs = get_versions('editor')
kwargs.update(urls)
kwargs.update(URLS)
message = """\
<p><b>LArray Editor</b> {editor}
<br>The Graphical User Interface for LArray
Expand All @@ -267,9 +269,8 @@ def about(self):
<ul>
<li>Python {python} on {system} {bitness:d}bits</li>
"""
for dep in dependencies['editor']:
if kwargs[dep] != 'N/A':
message += f"<li>{dep} {{{dep}}}</li>\n"
for dep in DEPENDENCIES['editor']:
message += f"<li>{dep} {kwargs[dep]}</li>\n"
message += "</ul>"
QMessageBox.about(self, _("About LArray Editor"), message.format(**kwargs))

Expand Down Expand Up @@ -698,9 +699,13 @@ def ipython_cell_executed(self):
setitem_match = setitem_pattern.match(last_input)
if setitem_match:
varname = setitem_match.group(1)
# otherwise it should have failed at this point, but let us be sure
# setitem to (i)python special variables do not concern us
if varname in clean_ns:
if self._display_in_grid(varname, clean_ns[varname]):
# For better or worse, _save_data() only saves "displayable data"
# so changes to variables we cannot display do not concern us,
# and this line should not be moved outside the if condition.
self.unsaved_modifications = True
# XXX: this completely refreshes the array, including detecting scientific & ndigits, which might
# not be what we want in this case
self.select_list_item(varname)
Expand Down
37 changes: 20 additions & 17 deletions larray_editor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@
logger = logging.getLogger("editor")


core_dependencies = ['numpy', 'pandas', 'matplotlib', 'pytables', 'xlwings', 'xlsxwriter', 'xlrd', 'openpyxl']
editor_dependencies = ['larray', 'larray_eurostat', 'qt'] + core_dependencies
eurostat_dependencies = ['larray']
dependencies = {'editor': editor_dependencies, 'larray': core_dependencies, 'larray_eurostat': eurostat_dependencies}
CORE_DEPENDENCIES = ['matplotlib', 'numpy', 'openpyxl', 'pandas', 'pytables', 'xlsxwriter', 'xlrd', 'xlwings']
EDITOR_DEPENDENCIES = ['larray', 'larray_eurostat', 'qt'] + CORE_DEPENDENCIES
EUROSTAT_DEPENDENCIES = ['larray']
DEPENDENCIES = {'editor': EDITOR_DEPENDENCIES, 'larray': CORE_DEPENDENCIES, 'larray_eurostat': EUROSTAT_DEPENDENCIES}


doc = "http://larray.readthedocs.io/en/{version}"
urls = {"fpb": "http://www.plan.be/index.php?lang=en",
DOC = "http://larray.readthedocs.io/en/{version}"
URLS = {"fpb": "http://www.plan.be/index.php?lang=en",
"GPL3": "https://www.gnu.org/licenses/gpl-3.0.html",
"doc_index": f"{doc}/index.html",
"doc_tutorial": f"{doc}/tutorial.html",
"doc_api": f"{doc}/api.html",
"doc_index": f"{DOC}/index.html",
"doc_tutorial": f"{DOC}/tutorial.html",
"doc_api": f"{DOC}/api.html",
"new_issue_editor": "https://github.com/larray-project/larray-editor/issues/new",
"new_issue_larray": "https://github.com/larray-project/larray/issues/new",
"new_issue_larray_eurostat": "https://github.com/larray-project/larray_eurostat/issues/new",
Expand All @@ -62,9 +62,10 @@ def get_module_version(module_name):
from qtpy import API_NAME, PYQT_VERSION # API_NAME --> PyQt5 or PyQt4
qt_version = module.__version__
return f'{qt_version}, {API_NAME} {PYQT_VERSION}'
elif '__version__' in dir(module):
# at least for matplotlib, we cannot test this using '__version__' in dir(module)
elif hasattr(module, '__version__'):
return module.__version__
elif '__VERSION__' in dir(module):
elif hasattr(module, '__VERSION__'):
return module.__VERSION__
else:
return 'N/A'
Expand All @@ -73,19 +74,21 @@ def get_module_version(module_name):


def get_versions(package):
"""Get version information of dependencies of a package"""
"""Get version information of dependencies of one of our packages
`package` can be one of 'editor', 'larray' or 'larray_eurostat'
"""
import platform
modules = {'editor': 'larray_editor', 'qt': 'qtpy.QtCore', 'pytables': 'tables'}
module_with_version = {'editor': 'larray_editor', 'qt': 'qtpy.QtCore', 'pytables': 'tables'}

versions = {
'system': platform.system() if sys.platform != 'darwin' else 'Darwin',
'python': platform.python_version(),
'bitness': 64 if sys.maxsize > 2**32 else 32,
}

versions[package] = get_module_version(modules.get(package, package))
for dep in dependencies[package]:
versions[dep] = get_module_version(modules.get(dep, dep))
versions[package] = get_module_version(module_with_version.get(package, package))
for dep in DEPENDENCIES[package]:
versions[dep] = get_module_version(module_with_version.get(dep, dep))

return versions

Expand All @@ -94,7 +97,7 @@ def get_documentation_url(key):
version = get_module_version('larray')
if version == 'N/A':
version = 'stable'
return urls[key].format(version=version)
return URLS[key].format(version=version)


# Note: string and unicode data types will be formatted with '%s' (see below)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def readlocal(fname):


DISTNAME = 'larray-editor'
VERSION = '0.34.3'
VERSION = '0.34.5-dev'
AUTHOR = 'Gaetan de Menten, Geert Bryon, Johan Duyck, Alix Damman'
AUTHOR_EMAIL = '[email protected]'
DESCRIPTION = "Graphical User Interface for LArray library"
Expand Down
Loading