babelplot 2025.9__tar.gz → 2025.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. {babelplot-2025.9 → babelplot-2025.10}/PKG-INFO +1 -1
  2. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/backend/catalog/bokeh_.py +10 -5
  3. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/backend/catalog/matplotlib_.py +5 -6
  4. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/backend/catalog/plotly_.py +10 -6
  5. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/backend/catalog/vedo_.py +9 -1
  6. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/task/showing.py +67 -11
  7. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/type/figure.py +1 -17
  8. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/version.py +1 -1
  9. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot.egg-info/PKG-INFO +1 -1
  10. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot.egg-info/SOURCES.txt +0 -1
  11. babelplot-2025.9/package/babelplot/runtime/application.py +0 -60
  12. {babelplot-2025.9 → babelplot-2025.10}/MANIFEST.in +0 -0
  13. {babelplot-2025.9 → babelplot-2025.10}/README-COPYRIGHT-utf8.txt +0 -0
  14. {babelplot-2025.9 → babelplot-2025.10}/README-LICENCE-utf8.txt +0 -0
  15. {babelplot-2025.9 → babelplot-2025.10}/README.rst +0 -0
  16. {babelplot-2025.9 → babelplot-2025.10}/documentation/wiki/description.asciidoc +0 -0
  17. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/__init__.py +0 -0
  18. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/api/backend.py +0 -0
  19. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/api/definition.py +0 -0
  20. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/api/help.py +0 -0
  21. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/backend/helper/creation.py +0 -0
  22. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/backend/helper/validation.py +0 -0
  23. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/constant/backend.py +0 -0
  24. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/constant/path.py +0 -0
  25. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/constant/project.py +0 -0
  26. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/extension/enum_.py +0 -0
  27. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/extension/function.py +0 -0
  28. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/runtime/backends.py +0 -0
  29. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/task/color.py +0 -0
  30. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/task/help.py +0 -0
  31. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/task/instantiation.py +0 -0
  32. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/task/plotting.py +0 -0
  33. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/type/backend.py +0 -0
  34. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/type/dimension.py +0 -0
  35. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/type/ffp_base.py +0 -0
  36. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/type/frame.py +0 -0
  37. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/type/plot.py +0 -0
  38. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/type/plot_function.py +0 -0
  39. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/type/plot_type.py +0 -0
  40. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot/type/translator.py +0 -0
  41. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot.egg-info/dependency_links.txt +0 -0
  42. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot.egg-info/requires.txt +0 -0
  43. {babelplot-2025.9 → babelplot-2025.10}/package/babelplot.egg-info/top_level.txt +0 -0
  44. {babelplot-2025.9 → babelplot-2025.10}/pyproject.toml +0 -0
  45. {babelplot-2025.9 → babelplot-2025.10}/requirements.txt +0 -0
  46. {babelplot-2025.9 → babelplot-2025.10}/setup.cfg +0 -0
  47. {babelplot-2025.9 → babelplot-2025.10}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: babelplot
3
- Version: 2025.9
3
+ Version: 2025.10
4
4
  Summary: A Meta Plotting Library That Speaks Several Backends
5
5
  Home-page: https://src.koda.cnrs.fr/eric.debreuve/babelplot/
6
6
  Author: Eric Debreuve
@@ -5,11 +5,12 @@ SEE COPYRIGHT NOTICE BELOW
5
5
  """
6
6
 
7
7
  import dataclasses as d
8
+ import gzip
8
9
  import typing as h
10
+ from multiprocessing import Process as process_t
9
11
 
10
- from babelplot.runtime.application import QT_APPLICATION
11
12
  from babelplot.task.plotting import NewPlotFunctionsTemplate, SetDefaultPlotFunction
12
- from babelplot.task.showing import NewPyQtWidgetWithHTML, widget_t
13
+ from babelplot.task.showing import ShowHTMLPlotWithPyQt
13
14
  from babelplot.type.dimension import dim_e
14
15
  from babelplot.type.figure import figure_t as base_figure_t
15
16
  from babelplot.type.frame import frame_t as base_frame_t
@@ -56,7 +57,6 @@ class frame_t(base_frame_t):
56
57
  @d.dataclass(slots=True, repr=False, eq=False)
57
58
  class figure_t(base_figure_t):
58
59
 
59
- widget: widget_t | None = d.field(init=False, default=None)
60
60
  layout: h.Any = d.field(init=False, default=None)
61
61
 
62
62
  def _NewBackendFigure(self, *args, **kwargs) -> backend_figure_t:
@@ -128,6 +128,7 @@ class figure_t(base_figure_t):
128
128
  """"""
129
129
  try:
130
130
  html = HTMLofBackendContent(self.layout, INLINE)
131
+ html = gzip.compress(html.encode())
131
132
  except ValueError as exception:
132
133
  html = f"""
133
134
  <!DOCTYPE html>
@@ -138,10 +139,14 @@ class figure_t(base_figure_t):
138
139
  </body>
139
140
  </html>
140
141
  """
141
- self.widget = NewPyQtWidgetWithHTML(html)
142
+
143
+ process = process_t(target=ShowHTMLPlotWithPyQt, args=(html,))
144
+ process.start()
142
145
 
143
146
  if modal:
144
- QT_APPLICATION.exec()
147
+ process.join()
148
+ else:
149
+ self.showing_process = process
145
150
 
146
151
 
147
152
  def _DefaultFunction(type_: plot_e, frame_dim: int, /) -> plot_function_h:
@@ -5,13 +5,11 @@ SEE COPYRIGHT NOTICE BELOW
5
5
  """
6
6
 
7
7
  import dataclasses as d
8
- import importlib as mprt
9
8
  import typing as h
10
9
 
11
10
  import matplotlib.pyplot as pypl # noqa
12
11
  import numpy as nmpy
13
12
  import skimage.measure as msre
14
- from babelplot.constant.path import QT_RUNTIME_PY_PATH
15
13
  from babelplot.task.color import NewConvertedColor
16
14
  from babelplot.task.plotting import NewPlotFunctionsTemplate
17
15
  from babelplot.type.dimension import dim_e
@@ -33,7 +31,6 @@ from matplotlib.pyplot import figure as NewBackendFigure # noqa
33
31
  from mpl_toolkits.mplot3d import Axes3D as backend_frame_3d_t # noqa
34
32
 
35
33
  import matplotlib as mtpl # noqa
36
- import matplotlib as mlpl # noqa
37
34
 
38
35
  NAME = "matplotlib"
39
36
 
@@ -45,7 +42,7 @@ backend_frame_h = backend_frame_2d_t | backend_frame_3d_t
45
42
  def _DefaultProperties(type_: type[plot_type_h], /) -> dict[str, h.Any]:
46
43
  """"""
47
44
  name = type_.__name__
48
- properties = mlpl.rcParams.find_all(f"^{name}\\.")
45
+ properties = mtpl.rcParams.find_all(f"^{name}\\.")
49
46
 
50
47
  return {_key.replace(f"{name}.", ""): _vle for _key, _vle in properties.items()}
51
48
 
@@ -207,8 +204,10 @@ class figure_t(base_figure_t):
207
204
 
208
205
  if modal:
209
206
  if "qt" in mtpl.get_backend().lower():
210
- module = mprt.import_module(QT_RUNTIME_PY_PATH)
211
- module.QT_APPLICATION.exec()
207
+ from matplotlib.backends.qt_compat import QtWidgets # noqa
208
+
209
+ application = QtWidgets.QApplication.instance()
210
+ application.exec()
212
211
  else:
213
212
  event_manager = self.raw.canvas
214
213
  event_manager.mpl_connect("close_event", _OnCloseEvent)
@@ -5,15 +5,16 @@ SEE COPYRIGHT NOTICE BELOW
5
5
  """
6
6
 
7
7
  import dataclasses as d
8
+ import gzip
8
9
  import typing as h
10
+ from multiprocessing import Process as process_t
9
11
  from pathlib import Path as path_t
10
12
 
11
13
  import numpy as nmpy
12
14
  import plotly.figure_factory as fcry # noqa
13
15
  import plotly.graph_objects as plly # noqa
14
- from babelplot.runtime.application import QT_APPLICATION
15
16
  from babelplot.task.plotting import NewPlotFunctionsTemplate
16
- from babelplot.task.showing import NewPyQtWidgetWithHTML, widget_t
17
+ from babelplot.task.showing import ShowHTMLPlotWithPyQt
17
18
  from babelplot.type.dimension import dim_e
18
19
  from babelplot.type.figure import figure_t as base_figure_t
19
20
  from babelplot.type.frame import frame_t as base_frame_t
@@ -66,8 +67,6 @@ class frame_t(base_frame_t):
66
67
  @d.dataclass(slots=True, repr=False, eq=False)
67
68
  class figure_t(base_figure_t):
68
69
 
69
- widget: widget_t | None = d.field(init=False, default=None)
70
-
71
70
  def _NewBackendFigure(self, *args, **kwargs) -> backend_figure_t:
72
71
  """"""
73
72
  return backend_figure_t(*args, **kwargs)
@@ -143,10 +142,15 @@ class figure_t(base_figure_t):
143
142
  See note in babelplot.task.html.Show.
144
143
  """
145
144
  html = self.raw.to_html(include_plotlyjs=True, config=_FIGURE_CONFIG)
146
- self.widget = NewPyQtWidgetWithHTML(html)
145
+ html = gzip.compress(html.encode())
146
+
147
+ process = process_t(target=ShowHTMLPlotWithPyQt, args=(html,))
148
+ process.start()
147
149
 
148
150
  if modal:
149
- QT_APPLICATION.exec()
151
+ process.join()
152
+ else:
153
+ self.showing_process = process
150
154
 
151
155
 
152
156
  def _Arrows2(*args, **kwargs) -> backend_plot_t:
@@ -5,6 +5,7 @@ SEE COPYRIGHT NOTICE BELOW
5
5
  """
6
6
 
7
7
  import dataclasses as d
8
+ from multiprocessing import Process as process_t
8
9
 
9
10
  from babelplot.task.color import NewConvertedColor
10
11
  from babelplot.task.plotting import NewPlotFunctionsTemplate
@@ -81,7 +82,14 @@ class figure_t(base_figure_t):
81
82
  """"""
82
83
  # Passing self.raw.show().close shows the figures one by one.
83
84
  BackendShow = lambda: self.raw.show().close()
84
- self._LaunchBackendShow(modal, BackendShow)
85
+
86
+ process = process_t(target=BackendShow)
87
+ process.start()
88
+
89
+ if modal:
90
+ process.join()
91
+ else:
92
+ self.showing_process = process
85
93
 
86
94
 
87
95
  def _IsoSurface(volume: array_t, iso_value: float, *_, **kwargs) -> backend_plot_t:
@@ -4,31 +4,71 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2022
4
4
  SEE COPYRIGHT NOTICE BELOW
5
5
  """
6
6
 
7
+ import gzip
7
8
  import os as ostm
9
+ import sys as s
8
10
  import tempfile as tmpf
9
11
  import time
10
12
  import typing as h
11
13
 
14
+ from babelplot.constant.project import NAME
12
15
  from babelplot.type.figure import figure_t
13
16
  from PyQt6.QtCore import QUrl as url_t
14
- from PyQt6.QtWebEngineWidgets import QWebEngineView as widget_t
17
+ from PyQt6.QtWebEngineWidgets import QWebEngineView as web_view_t
18
+ from PyQt6.QtWidgets import QApplication as application_t
19
+ from PyQt6.QtWidgets import QStackedWidget as stack_t
20
+
21
+ TOO_BIG_OF_AN_HTML = 5_000_000
22
+ PATIENCE = """
23
+ <!DOCTYPE html>
24
+ <html>
25
+ <head>
26
+ <style>
27
+ html, body {
28
+ height: 100%;
29
+ }
30
+ div {
31
+ width: 100%;
32
+ height: 100%;
33
+ display: table;
34
+ text-align: center;
35
+ }
36
+ p {
37
+ display: table-cell;
38
+ vertical-align: middle;
39
+ font-size: 4vw;
40
+ font-weight: bold;
41
+ font-family: monospace;
42
+ color: darkgrey;
43
+ }
44
+ </style>
45
+ </head>
46
+ <body>
47
+ <div>
48
+ <p>Preparing Plot...</p>
49
+ <div/>
50
+ </body>
51
+ </html>
52
+ """
15
53
 
16
54
 
17
- def NewPyQtWidgetWithHTML(html: str, /) -> widget_t:
55
+ def ShowHTMLPlotWithPyQt(html: str | bytes, /) -> None:
18
56
  """"""
19
57
 
20
58
  def _SetURLIfNeeded(success: bool, /) -> None:
21
59
  """
22
60
  From: https://doc.qt.io/qtforpython-6/PySide6/QtWebEngineWidgets/QWebEngineView.html
23
61
  #PySide6.QtWebEngineWidgets.PySide6.QtWebEngineWidgets.QWebEngineView.setHtml
24
- Content larger than 2 MB cannot be displayed...
25
- ...
62
+ Content larger than 2 MB cannot be displayed[...]
63
+ [...]
26
64
  Thereby, the provided code becomes a URL that exceeds the 2 MB limit set by
27
65
  Chromium. If the content is too large, the loadFinished() signal is
28
66
  triggered with success=False.
29
67
  Solution: Use a temporary file (with html extension) and setUrl.
30
68
  """
31
69
  if success:
70
+ if main is not web_view:
71
+ main.setCurrentWidget(web_view)
32
72
  return
33
73
 
34
74
  transfer = tmpf.NamedTemporaryFile(mode="w", suffix=".html", delete=False)
@@ -36,16 +76,32 @@ def NewPyQtWidgetWithHTML(html: str, /) -> widget_t:
36
76
  accessor.write(html)
37
77
  url = url_t.fromLocalFile(transfer.name)
38
78
 
39
- widget.setUrl(url)
40
- widget.closeEvent = lambda _: ostm.remove(transfer.name)
79
+ web_view.setUrl(url)
80
+ web_view.closeEvent = lambda _: ostm.remove(transfer.name)
81
+
82
+ if isinstance(html, bytes):
83
+ html = gzip.decompress(html).decode()
84
+
85
+ application = application_t(s.argv)
86
+ application.setApplicationName(NAME) # Useful for window manager.
87
+
88
+ web_view = web_view_t()
89
+ web_view.loadFinished.connect(_SetURLIfNeeded)
90
+ web_view.setHtml(html) # Now attempt to set HTML; If failure, then _SetURLIfNeeded.
41
91
 
42
- widget = widget_t()
43
- widget.loadFinished.connect(_SetURLIfNeeded)
44
- widget.setHtml(html) # Now attempt to set HTML; If failure, then _SetURLIfNeeded.
92
+ if html.__len__() > TOO_BIG_OF_AN_HTML:
93
+ patience = web_view_t()
94
+ patience.setHtml(PATIENCE)
45
95
 
46
- widget.show()
96
+ main = stack_t()
97
+ main.addWidget(web_view)
98
+ main.addWidget(patience)
99
+ main.setCurrentWidget(patience)
100
+ else:
101
+ main = web_view
47
102
 
48
- return widget
103
+ main.show()
104
+ application.exec()
49
105
 
50
106
 
51
107
  def ShowFigures(figures: h.Sequence[figure_t], /) -> None:
@@ -199,24 +199,8 @@ class figure_t(base_t):
199
199
  self._BackendShow(modal)
200
200
 
201
201
  def _BackendShow(self, modal: bool, /) -> None:
202
- """
203
- Normally, should show the figure and manage the event loop, depending on the
204
- value of modal. But, can decide to defer the task to self by calling
205
- self._LaunchBackendShow. This allows to factorize code for backends supporting
206
- multiprocessing.
207
- """
208
- raise NotImplementedError
209
-
210
- def _LaunchBackendShow(
211
- self, modal: bool, BackendShow: h.Callable[..., None], /, *args
212
- ) -> None:
213
202
  """"""
214
- if modal:
215
- BackendShow(*args)
216
- else:
217
- process = process_t(target=BackendShow, args=args)
218
- process.start()
219
- self.showing_process = process
203
+ raise NotImplementedError
220
204
 
221
205
 
222
206
  """
@@ -4,7 +4,7 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2022
4
4
  SEE COPYRIGHT NOTICE BELOW
5
5
  """
6
6
 
7
- __version__ = "2025.9"
7
+ __version__ = "2025.10"
8
8
 
9
9
  """
10
10
  COPYRIGHT NOTICE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: babelplot
3
- Version: 2025.9
3
+ Version: 2025.10
4
4
  Summary: A Meta Plotting Library That Speaks Several Backends
5
5
  Home-page: https://src.koda.cnrs.fr/eric.debreuve/babelplot/
6
6
  Author: Eric Debreuve
@@ -27,7 +27,6 @@ package/babelplot/constant/path.py
27
27
  package/babelplot/constant/project.py
28
28
  package/babelplot/extension/enum_.py
29
29
  package/babelplot/extension/function.py
30
- package/babelplot/runtime/application.py
31
30
  package/babelplot/runtime/backends.py
32
31
  package/babelplot/task/color.py
33
32
  package/babelplot/task/help.py
@@ -1,60 +0,0 @@
1
- """
2
- Copyright CNRS/Inria/UniCA
3
- Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2022
4
- SEE COPYRIGHT NOTICE BELOW
5
- """
6
-
7
- import sys as s
8
-
9
- from babelplot.constant.project import NAME
10
- from PyQt6.QtWidgets import QApplication as application_t # noqa
11
-
12
- if (QT_APPLICATION := application_t.instance()) is None:
13
- QT_APPLICATION = application_t(s.argv)
14
- QT_APPLICATION.setApplicationName(NAME) # Useful for window manager.
15
-
16
- """
17
- COPYRIGHT NOTICE
18
-
19
- This software is governed by the CeCILL license under French law and
20
- abiding by the rules of distribution of free software. You can use,
21
- modify and/ or redistribute the software under the terms of the CeCILL
22
- license as circulated by CEA, CNRS and INRIA at the following URL
23
- "http://www.cecill.info".
24
-
25
- As a counterpart to the access to the source code and rights to copy,
26
- modify and redistribute granted by the license, users are provided only
27
- with a limited warranty and the software's author, the holder of the
28
- economic rights, and the successive licensors have only limited
29
- liability.
30
-
31
- In this respect, the user's attention is drawn to the risks associated
32
- with loading, using, modifying and/or developing or reproducing the
33
- software by the user in light of its specific status of free software,
34
- that may mean that it is complicated to manipulate, and that also
35
- therefore means that it is reserved for developers and experienced
36
- professionals having in-depth computer knowledge. Users are therefore
37
- encouraged to load and test the software's suitability as regards their
38
- requirements in conditions enabling the security of their systems and/or
39
- data to be ensured and, more generally, to use and operate it in the
40
- same conditions as regards security.
41
-
42
- The fact that you are presently reading this means that you have had
43
- knowledge of the CeCILL license and that you accept its terms.
44
-
45
- SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
46
-
47
- This software is being developed by Eric Debreuve, a CNRS employee and
48
- member of team Morpheme.
49
- Team Morpheme is a joint team between Inria, CNRS, and UniCA.
50
- It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
51
- I3S, and Laboratory iBV.
52
-
53
- CNRS: https://www.cnrs.fr/index.php/en
54
- Inria: https://www.inria.fr/en/
55
- UniCA: https://univ-cotedazur.eu/
56
- Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
57
- I3S: https://www.i3s.unice.fr/en/
58
- iBV: http://ibv.unice.fr/
59
- Team Morpheme: https://team.inria.fr/morpheme/
60
- """
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes