babelplot 2025.2__tar.gz → 2025.4__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 (44) hide show
  1. {babelplot-2025.2 → babelplot-2025.4}/PKG-INFO +2 -2
  2. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/__init__.py +1 -3
  3. babelplot-2025.4/package/babelplot/api/backend.py +55 -0
  4. babelplot-2025.4/package/babelplot/api/definition.py +55 -0
  5. babelplot-2025.4/package/babelplot/api/help.py +54 -0
  6. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/backend/catalog/bokeh_.py +3 -3
  7. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/backend/catalog/matplotlib_.py +7 -7
  8. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/backend/catalog/plotly_.py +3 -3
  9. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/backend/catalog/vedo_.py +3 -3
  10. {babelplot-2025.2/package/babelplot/backend/specification → babelplot-2025.4/package/babelplot/backend/definition}/backend.py +36 -44
  11. {babelplot-2025.2/package/babelplot/backend/specification → babelplot-2025.4/package/babelplot/backend/definition}/runtime.py +1 -1
  12. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/backend/helper/creation.py +4 -15
  13. babelplot-2025.4/package/babelplot/backend/helper/validation.py +130 -0
  14. babelplot-2025.4/package/babelplot/constant/backend.py +96 -0
  15. babelplot-2025.2/package/babelplot/constant/backend.py → babelplot-2025.4/package/babelplot/constant/path.py +2 -1
  16. {babelplot-2025.2/package/babelplot/specification → babelplot-2025.4/package/babelplot/definition}/plot.py +34 -29
  17. babelplot-2025.4/package/babelplot/extension/ast_.py +155 -0
  18. babelplot-2025.4/package/babelplot/extension/function.py +146 -0
  19. {babelplot-2025.2/package/babelplot → babelplot-2025.4/package/babelplot/task}/help.py +27 -25
  20. babelplot-2025.2/package/babelplot/main.py → babelplot-2025.4/package/babelplot/task/instantiation.py +12 -12
  21. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/task/show_pyqt6.py +14 -12
  22. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/type/base.py +6 -6
  23. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/type/figure.py +8 -8
  24. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/type/frame.py +4 -8
  25. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/type/plot.py +1 -1
  26. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/version.py +1 -1
  27. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot.egg-info/PKG-INFO +2 -2
  28. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot.egg-info/SOURCES.txt +12 -6
  29. babelplot-2025.2/package/babelplot/backend/helper/validation.py +0 -269
  30. {babelplot-2025.2 → babelplot-2025.4}/MANIFEST.in +0 -0
  31. {babelplot-2025.2 → babelplot-2025.4}/README-COPYRIGHT-utf8.txt +0 -0
  32. {babelplot-2025.2 → babelplot-2025.4}/README-LICENCE-utf8.txt +0 -0
  33. {babelplot-2025.2 → babelplot-2025.4}/README.rst +0 -0
  34. {babelplot-2025.2 → babelplot-2025.4}/documentation/wiki/description.asciidoc +0 -0
  35. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/constant/project.py +0 -0
  36. {babelplot-2025.2/package/babelplot/specification → babelplot-2025.4/package/babelplot/definition}/dimension.py +0 -0
  37. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot/extension/enum_.py +0 -0
  38. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot.egg-info/dependency_links.txt +0 -0
  39. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot.egg-info/requires.txt +0 -0
  40. {babelplot-2025.2 → babelplot-2025.4}/package/babelplot.egg-info/top_level.txt +0 -0
  41. {babelplot-2025.2 → babelplot-2025.4}/pyproject.toml +0 -0
  42. {babelplot-2025.2 → babelplot-2025.4}/requirements.txt +0 -0
  43. {babelplot-2025.2 → babelplot-2025.4}/setup.cfg +0 -0
  44. {babelplot-2025.2 → babelplot-2025.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: babelplot
3
- Version: 2025.2
3
+ Version: 2025.4
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
@@ -17,9 +17,7 @@ else:
17
17
  if folder not in paths:
18
18
  beartype_this_package()
19
19
 
20
- from babelplot.backend.specification.backend import backend_e
21
- from babelplot.main import NewFigure, NewPlot
22
- from babelplot.specification.plot import plot_e
20
+ from babelplot.task.instantiation import NewFigure, NewPlot
23
21
  from babelplot.type.figure import ShowAllFigures
24
22
  from babelplot.version import __version__
25
23
 
@@ -0,0 +1,55 @@
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
+ from babelplot.backend.definition.runtime import AddBackendSpecification # noqa
8
+ from babelplot.backend.helper.creation import PrintBackendDraft # noqa
9
+ from babelplot.backend.helper.validation import CheckBackend # noqa
10
+
11
+ """
12
+ COPYRIGHT NOTICE
13
+
14
+ This software is governed by the CeCILL license under French law and
15
+ abiding by the rules of distribution of free software. You can use,
16
+ modify and/ or redistribute the software under the terms of the CeCILL
17
+ license as circulated by CEA, CNRS and INRIA at the following URL
18
+ "http://www.cecill.info".
19
+
20
+ As a counterpart to the access to the source code and rights to copy,
21
+ modify and redistribute granted by the license, users are provided only
22
+ with a limited warranty and the software's author, the holder of the
23
+ economic rights, and the successive licensors have only limited
24
+ liability.
25
+
26
+ In this respect, the user's attention is drawn to the risks associated
27
+ with loading, using, modifying and/or developing or reproducing the
28
+ software by the user in light of its specific status of free software,
29
+ that may mean that it is complicated to manipulate, and that also
30
+ therefore means that it is reserved for developers and experienced
31
+ professionals having in-depth computer knowledge. Users are therefore
32
+ encouraged to load and test the software's suitability as regards their
33
+ requirements in conditions enabling the security of their systems and/or
34
+ data to be ensured and, more generally, to use and operate it in the
35
+ same conditions as regards security.
36
+
37
+ The fact that you are presently reading this means that you have had
38
+ knowledge of the CeCILL license and that you accept its terms.
39
+
40
+ SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
41
+
42
+ This software is being developed by Eric Debreuve, a CNRS employee and
43
+ member of team Morpheme.
44
+ Team Morpheme is a joint team between Inria, CNRS, and UniCA.
45
+ It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
46
+ I3S, and Laboratory iBV.
47
+
48
+ CNRS: https://www.cnrs.fr/index.php/en
49
+ Inria: https://www.inria.fr/en/
50
+ UniCA: https://univ-cotedazur.eu/
51
+ Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
52
+ I3S: https://www.i3s.unice.fr/en/
53
+ iBV: http://ibv.unice.fr/
54
+ Team Morpheme: https://team.inria.fr/morpheme/
55
+ """
@@ -0,0 +1,55 @@
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
+ from babelplot.backend.definition.backend import backend_e # noqa
8
+ from babelplot.definition.dimension import dim_e # noqa
9
+ from babelplot.definition.plot import plot_e # noqa
10
+
11
+ """
12
+ COPYRIGHT NOTICE
13
+
14
+ This software is governed by the CeCILL license under French law and
15
+ abiding by the rules of distribution of free software. You can use,
16
+ modify and/ or redistribute the software under the terms of the CeCILL
17
+ license as circulated by CEA, CNRS and INRIA at the following URL
18
+ "http://www.cecill.info".
19
+
20
+ As a counterpart to the access to the source code and rights to copy,
21
+ modify and redistribute granted by the license, users are provided only
22
+ with a limited warranty and the software's author, the holder of the
23
+ economic rights, and the successive licensors have only limited
24
+ liability.
25
+
26
+ In this respect, the user's attention is drawn to the risks associated
27
+ with loading, using, modifying and/or developing or reproducing the
28
+ software by the user in light of its specific status of free software,
29
+ that may mean that it is complicated to manipulate, and that also
30
+ therefore means that it is reserved for developers and experienced
31
+ professionals having in-depth computer knowledge. Users are therefore
32
+ encouraged to load and test the software's suitability as regards their
33
+ requirements in conditions enabling the security of their systems and/or
34
+ data to be ensured and, more generally, to use and operate it in the
35
+ same conditions as regards security.
36
+
37
+ The fact that you are presently reading this means that you have had
38
+ knowledge of the CeCILL license and that you accept its terms.
39
+
40
+ SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
41
+
42
+ This software is being developed by Eric Debreuve, a CNRS employee and
43
+ member of team Morpheme.
44
+ Team Morpheme is a joint team between Inria, CNRS, and UniCA.
45
+ It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
46
+ I3S, and Laboratory iBV.
47
+
48
+ CNRS: https://www.cnrs.fr/index.php/en
49
+ Inria: https://www.inria.fr/en/
50
+ UniCA: https://univ-cotedazur.eu/
51
+ Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
52
+ I3S: https://www.i3s.unice.fr/en/
53
+ iBV: http://ibv.unice.fr/
54
+ Team Morpheme: https://team.inria.fr/morpheme/
55
+ """
@@ -0,0 +1,54 @@
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
+ from babelplot.task.help import Main as PrintHelp # noqa
8
+ from babelplot.task.help import PrintUsage # noqa
9
+
10
+ """
11
+ COPYRIGHT NOTICE
12
+
13
+ This software is governed by the CeCILL license under French law and
14
+ abiding by the rules of distribution of free software. You can use,
15
+ modify and/ or redistribute the software under the terms of the CeCILL
16
+ license as circulated by CEA, CNRS and INRIA at the following URL
17
+ "http://www.cecill.info".
18
+
19
+ As a counterpart to the access to the source code and rights to copy,
20
+ modify and redistribute granted by the license, users are provided only
21
+ with a limited warranty and the software's author, the holder of the
22
+ economic rights, and the successive licensors have only limited
23
+ liability.
24
+
25
+ In this respect, the user's attention is drawn to the risks associated
26
+ with loading, using, modifying and/or developing or reproducing the
27
+ software by the user in light of its specific status of free software,
28
+ that may mean that it is complicated to manipulate, and that also
29
+ therefore means that it is reserved for developers and experienced
30
+ professionals having in-depth computer knowledge. Users are therefore
31
+ encouraged to load and test the software's suitability as regards their
32
+ requirements in conditions enabling the security of their systems and/or
33
+ data to be ensured and, more generally, to use and operate it in the
34
+ same conditions as regards security.
35
+
36
+ The fact that you are presently reading this means that you have had
37
+ knowledge of the CeCILL license and that you accept its terms.
38
+
39
+ SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
40
+
41
+ This software is being developed by Eric Debreuve, a CNRS employee and
42
+ member of team Morpheme.
43
+ Team Morpheme is a joint team between Inria, CNRS, and UniCA.
44
+ It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
45
+ I3S, and Laboratory iBV.
46
+
47
+ CNRS: https://www.cnrs.fr/index.php/en
48
+ Inria: https://www.inria.fr/en/
49
+ UniCA: https://univ-cotedazur.eu/
50
+ Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
51
+ I3S: https://www.i3s.unice.fr/en/
52
+ iBV: http://ibv.unice.fr/
53
+ Team Morpheme: https://team.inria.fr/morpheme/
54
+ """
@@ -8,9 +8,9 @@ from __future__ import annotations
8
8
 
9
9
  import typing as h
10
10
 
11
- from babelplot.backend.specification.backend import backend_e
12
- from babelplot.specification.dimension import dim_e
13
- from babelplot.specification.plot import PlotsFromTemplate, plot_e, plot_type_h
11
+ from babelplot.backend.definition.backend import backend_e
12
+ from babelplot.definition.dimension import dim_e
13
+ from babelplot.definition.plot import PlotsFromTemplate, plot_e, plot_type_h
14
14
  from babelplot.task.show_pyqt6 import Show
15
15
  from babelplot.type.figure import figure_t as base_figure_t
16
16
  from babelplot.type.frame import frame_t as base_frame_t
@@ -11,14 +11,14 @@ import typing as h
11
11
  import matplotlib.pyplot as pypl # noqa
12
12
  import numpy as nmpy
13
13
  import skimage.measure as msre
14
- from babelplot.backend.specification.backend import backend_e
15
- from babelplot.specification.dimension import dim_e
16
- from babelplot.specification.plot import PlotsFromTemplate, plot_e, plot_type_h
17
- from babelplot.type.base import backend_element_h, backend_plot_h
14
+ from babelplot.backend.definition.backend import backend_e
15
+ from babelplot.definition.dimension import dim_e
16
+ from babelplot.definition.plot import PlotsFromTemplate, plot_e, plot_type_h
17
+ from babelplot.type.base import backend_element_h
18
18
  from babelplot.type.figure import figure_t as base_figure_t
19
19
  from babelplot.type.frame import frame_t as base_frame_t
20
20
  from babelplot.type.plot import plot_t as base_plot_t
21
- from logger_36 import LOGGER
21
+ from logger_36 import L
22
22
  from matplotlib.artist import Artist as backend_plot_t # noqa
23
23
  from matplotlib.container import Container as backend_plots_t # noqa
24
24
  from matplotlib.gridspec import GridSpec as grid_spec_t # noqa
@@ -162,7 +162,7 @@ def _SetProperty(
162
162
  try:
163
163
  pypl.setp(element, **property_)
164
164
  except AttributeError:
165
- LOGGER.error(
165
+ L.error(
166
166
  f'Property "{name}": Invalid property for element of type "{type(element).__name__}"'
167
167
  )
168
168
 
@@ -178,7 +178,7 @@ def _Property(
178
178
  output = pypl.getp(element, property=name)
179
179
  except AttributeError:
180
180
  output = None
181
- LOGGER.error(
181
+ L.error(
182
182
  f'Property "{name}": Invalid property for element of type "{type(element).__name__}"'
183
183
  )
184
184
 
@@ -12,14 +12,15 @@ from pathlib import Path as path_t
12
12
  import numpy as nmpy
13
13
  import plotly.figure_factory as fcry # noqa
14
14
  import plotly.graph_objects as plly # noqa
15
- from babelplot.backend.specification.backend import backend_e
16
- from babelplot.specification.plot import (
15
+ from babelplot.backend.definition.backend import backend_e
16
+ from babelplot.definition.plot import (
17
17
  UNDEFINED_PARAMETER,
18
18
  PlotsFromTemplate,
19
19
  plot_e,
20
20
  plot_type_h,
21
21
  )
22
22
  from babelplot.task.show_pyqt6 import Show
23
+ from babelplot.type.base import backend_frame_h
23
24
  from babelplot.type.figure import figure_t as base_figure_t
24
25
  from babelplot.type.frame import frame_t as base_frame_t
25
26
  from babelplot.type.plot import plot_t as base_plot_t
@@ -31,7 +32,6 @@ NAME = backend_e.PLOTLY.value
31
32
 
32
33
 
33
34
  array_t = nmpy.ndarray
34
- backend_frame_h = h.TypeVar("backend_frame_h")
35
35
 
36
36
 
37
37
  _FIGURE_CONFIG = {
@@ -9,9 +9,9 @@ from __future__ import annotations
9
9
  import typing as h
10
10
 
11
11
  import vedo # noqa
12
- from babelplot.backend.specification.backend import backend_e
13
- from babelplot.specification.dimension import dim_e
14
- from babelplot.specification.plot import PlotsFromTemplate, plot_e, plot_type_h
12
+ from babelplot.backend.definition.backend import backend_e
13
+ from babelplot.definition.dimension import dim_e
14
+ from babelplot.definition.plot import PlotsFromTemplate, plot_e, plot_type_h
15
15
  from babelplot.type.base import backend_plot_h
16
16
  from babelplot.type.figure import figure_t as base_figure_t
17
17
  from babelplot.type.frame import frame_t as base_frame_t
@@ -4,67 +4,59 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2022
4
4
  SEE COPYRIGHT NOTICE BELOW
5
5
  """
6
6
 
7
- import typing as h
8
7
  from enum import Enum as enum_t
9
- from enum import unique
10
8
 
9
+ from babelplot.constant.backend import BACKENDS
11
10
  from babelplot.extension.enum_ import EnumMembers, EnumValues
12
11
 
12
+ backend_e = enum_t("backend_e", ((_.upper(), _) for _ in BACKENDS.keys()))
13
13
 
14
- @unique
15
- class backend_e(enum_t):
16
- """
17
- Available plotting backends.
18
- """
14
+ IMPLEMENTED_BACKENDS_AS_STR = EnumValues(backend_e)
19
15
 
20
- BOKEH = "bokeh"
21
- MATPLOTLIB = "matplotlib"
22
- PLOTLY = "plotly"
23
- VEDO = "vedo"
16
+ # Some backends may have an alias. Here they are:
17
+ BACKEND_FROM_ALIAS = {
18
+ "mpl": backend_e.MATPLOTLIB,
19
+ "v3do": backend_e.VEDO,
20
+ }
21
+ BACKEND_ALIASES_AS_STR = tuple(BACKEND_FROM_ALIAS.keys())
24
22
 
25
- @classmethod
26
- def FormattedBackends(cls) -> str:
27
- """"""
28
- as_members = str(EnumMembers(cls))[1:-1].replace("'", "")
29
- as_names = str(IMPLEMENTED_BACKENDS_AS_STR)[1:-1].replace("'", "")
30
- as_aliases = (f"{_als} -> {_pbe}" for _als, _pbe in BACKEND_FROM_ALIAS.items())
31
23
 
32
- output = (
33
- f"As {cls.__name__} members: {as_members}\n"
34
- f"As names: {as_names}\n"
35
- f"As aliases: {', '.join(as_aliases)}"
36
- )
24
+ def FormattedBackends(cls) -> str:
25
+ """"""
26
+ as_members = str(EnumMembers(cls))[1:-1].replace("'", "")
27
+ as_names = str(IMPLEMENTED_BACKENDS_AS_STR)[1:-1].replace("'", "")
28
+ as_aliases = (f"{_als} -> {_pbe}" for _als, _pbe in BACKEND_FROM_ALIAS.items())
37
29
 
38
- return output
30
+ output = (
31
+ f"As {cls.__name__} members: {as_members}\n"
32
+ f"As names: {as_names}\n"
33
+ f"As aliases: {', '.join(as_aliases)}"
34
+ )
39
35
 
40
- @staticmethod
41
- def IsValid(name: str, /) -> bool:
42
- """"""
43
- return (name in IMPLEMENTED_BACKENDS_AS_STR) or (name in BACKEND_FROM_ALIAS)
36
+ return output
44
37
 
45
- @classmethod
46
- def NewFromName(cls, name: str, /) -> h.Self:
47
- """"""
48
- if name in IMPLEMENTED_BACKENDS_AS_STR:
49
- return cls(name)
50
- if name in BACKEND_FROM_ALIAS:
51
- return cls(BACKEND_FROM_ALIAS[name])
52
38
 
53
- raise ValueError(
54
- f"{name}: Invalid backend. Expected={IMPLEMENTED_BACKENDS_AS_STR+BACKEND_ALIASES_AS_STR}."
55
- )
39
+ def IsValid(name: str, /) -> bool:
40
+ """"""
41
+ return (name in IMPLEMENTED_BACKENDS_AS_STR) or (name in BACKEND_FROM_ALIAS)
56
42
 
57
43
 
58
- IMPLEMENTED_BACKENDS_AS_STR = EnumValues(backend_e)
44
+ def NewFromName(cls, name: str, /) -> backend_e:
45
+ """"""
46
+ if name in IMPLEMENTED_BACKENDS_AS_STR:
47
+ return cls(name)
48
+ if name in BACKEND_FROM_ALIAS:
49
+ return cls(BACKEND_FROM_ALIAS[name])
59
50
 
51
+ raise ValueError(
52
+ f"{name}: Invalid backend. "
53
+ f"Expected={IMPLEMENTED_BACKENDS_AS_STR+BACKEND_ALIASES_AS_STR}."
54
+ )
60
55
 
61
- # Some backends may have an alias. Here they are:
62
- BACKEND_FROM_ALIAS = {
63
- "mpl": backend_e.MATPLOTLIB,
64
- "v3do": backend_e.VEDO,
65
- }
66
- BACKEND_ALIASES_AS_STR = tuple(BACKEND_FROM_ALIAS.keys())
67
56
 
57
+ backend_e.FormattedBackends = classmethod(FormattedBackends)
58
+ backend_e.IsValid = staticmethod(IsValid)
59
+ backend_e.NewFromName = classmethod(NewFromName)
68
60
 
69
61
  NEW_THREAD_ACCEPTED_BY = {
70
62
  backend_e.BOKEH: True,
@@ -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
- from babelplot.specification.plot import arguments_translations_h, backend_plots_h
7
+ from babelplot.definition.plot import arguments_translations_h, backend_plots_h
8
8
 
9
9
  _BACKEND_SPECIFICATION = {}
10
10
 
@@ -7,9 +7,9 @@ SEE COPYRIGHT NOTICE BELOW
7
7
  import importlib as mprt
8
8
  import inspect as insp
9
9
  import re as rgex
10
- import sys as sstm
10
+ import sys as s
11
11
 
12
- from babelplot.backend.helper.validation import FunctionSignature, parameter_w_name_h
12
+ from babelplot.extension.function import FunctionSignature, parameter_w_name_h
13
13
 
14
14
  # insp.Parameter.POSITIONAL_ONLY
15
15
  # insp.Parameter.POSITIONAL_OR_KEYWORD
@@ -25,14 +25,14 @@ def PrintBackendDraft(target_class: str, /) -> None:
25
25
  f"{target_class}: Invalid class specification. "
26
26
  f"Expected=Must contain at least one dot."
27
27
  )
28
- sstm.exit(1)
28
+ s.exit(1)
29
29
 
30
30
  py_module, target_class = target_class.rsplit(sep=".", maxsplit=1)
31
31
  imported = mprt.import_module(py_module)
32
32
 
33
33
  if not hasattr(imported, target_class):
34
34
  print(f"{target_class}: Not a class of module {py_module}")
35
- sstm.exit(2)
35
+ s.exit(2)
36
36
 
37
37
  target_class = getattr(imported, target_class)
38
38
  for name in sorted(dir(target_class)):
@@ -86,17 +86,6 @@ def _ParameterIsPositional(parameter: parameter_w_name_h, /) -> bool:
86
86
  )
87
87
 
88
88
 
89
- if __name__ == "__main__":
90
- #
91
- if sstm.argv.__len__() < 2:
92
- print(
93
- "Missing backend plotting base class "
94
- "(as a Python specification such as module.[...]class)"
95
- )
96
- else:
97
- PrintBackendDraft(sstm.argv[1])
98
-
99
-
100
89
  """
101
90
  COPYRIGHT NOTICE
102
91
 
@@ -0,0 +1,130 @@
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 importlib as mprt
8
+ import sys as s
9
+ from pathlib import Path as path_t
10
+
11
+ from babelplot.constant.backend import BACKEND_METHOD_TAG, TYPE_PY_PATHS, TYPES
12
+ from babelplot.definition.plot import plot_e
13
+ from babelplot.extension.ast_ import (
14
+ CalledMethods,
15
+ DefinedMethods,
16
+ module_path_t,
17
+ py_module_h,
18
+ )
19
+ from babelplot.extension.function import SignaturePairIssues
20
+
21
+ _MethodNameIsValid = lambda _: BACKEND_METHOD_TAG in _
22
+
23
+
24
+ def CheckBackend(backend: py_module_h | module_path_t, /) -> None:
25
+ """"""
26
+ backend_path = path_t(backend)
27
+ if backend_path.is_file():
28
+ py_backend = backend_path.stem
29
+ spec = mprt.util.spec_from_file_location(py_backend, backend_path)
30
+ imported = mprt.util.module_from_spec(spec)
31
+ s.modules[py_backend] = imported
32
+ spec.loader.exec_module(imported)
33
+ else:
34
+ try:
35
+ imported = mprt.import_module(backend)
36
+ except ModuleNotFoundError as exception:
37
+ print(f"Backend {backend} failed to import:\n{exception}")
38
+ return
39
+
40
+ for reference, target_class in zip(TYPE_PY_PATHS, TYPES):
41
+ print(f"--- {target_class}")
42
+ required = CalledMethods(
43
+ reference, target_class, NameIsValid=_MethodNameIsValid
44
+ )
45
+ how_required = DefinedMethods(
46
+ reference,
47
+ mprt.import_module(reference),
48
+ target_class,
49
+ NameIsValid=_MethodNameIsValid,
50
+ should_keep_empty=True,
51
+ )
52
+ how_defined = DefinedMethods(
53
+ backend, imported, target_class, NameIsValid=_MethodNameIsValid
54
+ )
55
+
56
+ missing = []
57
+ for name in required:
58
+ if name in how_defined:
59
+ if name in how_required:
60
+ signa = how_required[name]
61
+ ture = how_defined[name]
62
+ issues = SignaturePairIssues(signa, ture)
63
+ if issues is not None:
64
+ print(f"{name}:\n ", "\n ".join(issues), sep="")
65
+ else:
66
+ missing.append(name)
67
+
68
+ as_str = str(missing)[1:-1]
69
+ if as_str.__len__() > 0:
70
+ print("Missing required method(s):", as_str.replace("'", ""))
71
+
72
+ if hasattr(imported, "PLOTS"):
73
+ defined = getattr(imported, "PLOTS")
74
+ if isinstance(defined, dict):
75
+ issues = plot_e.PlotsIssues(defined)
76
+ if issues is not None:
77
+ print(f"--- PLOTS:\n ", "\n ".join(issues), sep="")
78
+ else:
79
+ print(
80
+ f'--- {type(defined).__name__}: Invalid type for "PLOTS". Expected=dict.'
81
+ )
82
+ else:
83
+ print('--- Missing "PLOTS" dictionary')
84
+
85
+
86
+ """
87
+ COPYRIGHT NOTICE
88
+
89
+ This software is governed by the CeCILL license under French law and
90
+ abiding by the rules of distribution of free software. You can use,
91
+ modify and/ or redistribute the software under the terms of the CeCILL
92
+ license as circulated by CEA, CNRS and INRIA at the following URL
93
+ "http://www.cecill.info".
94
+
95
+ As a counterpart to the access to the source code and rights to copy,
96
+ modify and redistribute granted by the license, users are provided only
97
+ with a limited warranty and the software's author, the holder of the
98
+ economic rights, and the successive licensors have only limited
99
+ liability.
100
+
101
+ In this respect, the user's attention is drawn to the risks associated
102
+ with loading, using, modifying and/or developing or reproducing the
103
+ software by the user in light of its specific status of free software,
104
+ that may mean that it is complicated to manipulate, and that also
105
+ therefore means that it is reserved for developers and experienced
106
+ professionals having in-depth computer knowledge. Users are therefore
107
+ encouraged to load and test the software's suitability as regards their
108
+ requirements in conditions enabling the security of their systems and/or
109
+ data to be ensured and, more generally, to use and operate it in the
110
+ same conditions as regards security.
111
+
112
+ The fact that you are presently reading this means that you have had
113
+ knowledge of the CeCILL license and that you accept its terms.
114
+
115
+ SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
116
+
117
+ This software is being developed by Eric Debreuve, a CNRS employee and
118
+ member of team Morpheme.
119
+ Team Morpheme is a joint team between Inria, CNRS, and UniCA.
120
+ It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
121
+ I3S, and Laboratory iBV.
122
+
123
+ CNRS: https://www.cnrs.fr/index.php/en
124
+ Inria: https://www.inria.fr/en/
125
+ UniCA: https://univ-cotedazur.eu/
126
+ Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
127
+ I3S: https://www.i3s.unice.fr/en/
128
+ iBV: http://ibv.unice.fr/
129
+ Team Morpheme: https://team.inria.fr/morpheme/
130
+ """
@@ -0,0 +1,96 @@
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
+ from pathlib import Path as path_t
8
+
9
+ from babelplot.constant.path import BACKEND_CATALOG_PY_PATH
10
+
11
+ _BASE_PY_PATH = "babelplot.type"
12
+
13
+ TYPE_PY_PATHS = (
14
+ f"{_BASE_PY_PATH}.plot",
15
+ f"{_BASE_PY_PATH}.frame",
16
+ f"{_BASE_PY_PATH}.figure",
17
+ )
18
+ TYPES = ("plot_t", "frame_t", "figure_t")
19
+
20
+ BACKEND_METHOD_TAG = "Backend"
21
+ BACKEND_PLOT_STRIPE = "backend_plot_t"
22
+
23
+ BACKENDS = {}
24
+ _parent = path_t(__file__).parent.parent.parent
25
+ _catalog_path = _parent / path_t(*BACKEND_CATALOG_PY_PATH.split("."))
26
+ for node in _catalog_path.glob("*"):
27
+ if node.name.startswith("_"):
28
+ continue
29
+
30
+ if node.is_dir():
31
+ main = node / "main.py"
32
+ if main.is_file():
33
+ node = main
34
+ else:
35
+ continue
36
+
37
+ py_path = ".".join(node.relative_to(_parent).parent.parts + (node.stem,))
38
+ # try:
39
+ # module = mprt.import_module(py_path)
40
+ # except ModuleNotFoundError:
41
+ # continue
42
+ #
43
+ # stripe = getattr(module, BACKEND_PLOT_STRIPE, None)
44
+ # if stripe is None:
45
+ # backend_import_name = "<UNKNOWN_BACKEND_IMPORT_NAME>"
46
+ # else:
47
+ # backend_import_name = stripe.__module__.split(".")[0]
48
+
49
+ BACKENDS[node.stem[:-1]] = (node, py_path)
50
+
51
+
52
+ """
53
+ COPYRIGHT NOTICE
54
+
55
+ This software is governed by the CeCILL license under French law and
56
+ abiding by the rules of distribution of free software. You can use,
57
+ modify and/ or redistribute the software under the terms of the CeCILL
58
+ license as circulated by CEA, CNRS and INRIA at the following URL
59
+ "http://www.cecill.info".
60
+
61
+ As a counterpart to the access to the source code and rights to copy,
62
+ modify and redistribute granted by the license, users are provided only
63
+ with a limited warranty and the software's author, the holder of the
64
+ economic rights, and the successive licensors have only limited
65
+ liability.
66
+
67
+ In this respect, the user's attention is drawn to the risks associated
68
+ with loading, using, modifying and/or developing or reproducing the
69
+ software by the user in light of its specific status of free software,
70
+ that may mean that it is complicated to manipulate, and that also
71
+ therefore means that it is reserved for developers and experienced
72
+ professionals having in-depth computer knowledge. Users are therefore
73
+ encouraged to load and test the software's suitability as regards their
74
+ requirements in conditions enabling the security of their systems and/or
75
+ data to be ensured and, more generally, to use and operate it in the
76
+ same conditions as regards security.
77
+
78
+ The fact that you are presently reading this means that you have had
79
+ knowledge of the CeCILL license and that you accept its terms.
80
+
81
+ SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
82
+
83
+ This software is being developed by Eric Debreuve, a CNRS employee and
84
+ member of team Morpheme.
85
+ Team Morpheme is a joint team between Inria, CNRS, and UniCA.
86
+ It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
87
+ I3S, and Laboratory iBV.
88
+
89
+ CNRS: https://www.cnrs.fr/index.php/en
90
+ Inria: https://www.inria.fr/en/
91
+ UniCA: https://univ-cotedazur.eu/
92
+ Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
93
+ I3S: https://www.i3s.unice.fr/en/
94
+ iBV: http://ibv.unice.fr/
95
+ Team Morpheme: https://team.inria.fr/morpheme/
96
+ """