hiplot-mm 0.0.1__py3-none-any.whl → 0.0.3rc0__py3-none-any.whl

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 (58) hide show
  1. hiplot/ipython.py +38 -6
  2. hiplot/pkginfo.py +18 -2
  3. hiplot/server.py +8 -2
  4. hiplot/static/built/hiplot.bundle.js +1 -1
  5. hiplot/static/built/streamlit_component/hiplot_streamlit.bundle.js +1 -1
  6. hiplot/streamlit_helpers.py +11 -2
  7. {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info}/METADATA +51 -27
  8. hiplot_mm-0.0.3rc0.dist-info/RECORD +33 -0
  9. {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info}/WHEEL +1 -1
  10. {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info}/entry_points.txt +0 -1
  11. hiplot/static/built/component.d.ts +0 -109
  12. hiplot/static/built/component.js +0 -528
  13. hiplot/static/built/contextmenu.d.ts +0 -26
  14. hiplot/static/built/contextmenu.js +0 -90
  15. hiplot/static/built/controls.d.ts +0 -52
  16. hiplot/static/built/controls.js +0 -163
  17. hiplot/static/built/filters.d.ts +0 -21
  18. hiplot/static/built/filters.js +0 -96
  19. hiplot/static/built/header.d.ts +0 -39
  20. hiplot/static/built/header.js +0 -176
  21. hiplot/static/built/hiplot-mm-0.0.0.tar.gz +0 -0
  22. hiplot/static/built/hiplot.bundle.js.LICENSE.txt +0 -88
  23. hiplot/static/built/hiplot.bundle.js.map +0 -1
  24. hiplot/static/built/hiplot.d.ts +0 -8
  25. hiplot/static/built/hiplot.js +0 -14
  26. hiplot/static/built/hiplot.lib.js +0 -57712
  27. hiplot/static/built/hiplot.lib.js.map +0 -1
  28. hiplot/static/built/hiplot.licenses.txt +0 -682
  29. hiplot/static/built/hiplot_mm-0.0.0-py3-none-any.whl +0 -0
  30. hiplot/static/built/hiplot_streamlit.bundle.js +0 -3
  31. hiplot/static/built/hiplot_streamlit.bundle.js.LICENSE.txt +0 -97
  32. hiplot/static/built/hiplot_streamlit.bundle.js.map +0 -1
  33. hiplot/static/built/hiplot_streamlit.d.ts +0 -1
  34. hiplot/static/built/hiplot_streamlit.js +0 -85
  35. hiplot/static/built/hiplot_streamlit.licenses.txt +0 -689
  36. hiplot/static/built/hiplot_test.bundle.js +0 -3
  37. hiplot/static/built/hiplot_test.bundle.js.LICENSE.txt +0 -88
  38. hiplot/static/built/hiplot_test.bundle.js.map +0 -1
  39. hiplot/static/built/hiplot_test.d.ts +0 -46
  40. hiplot/static/built/hiplot_test.js +0 -238
  41. hiplot/static/built/hiplot_test.licenses.txt +0 -682
  42. hiplot/static/built/hiplot_web.d.ts +0 -3
  43. hiplot/static/built/hiplot_web.js +0 -54
  44. hiplot/static/built/infertypes.d.ts +0 -38
  45. hiplot/static/built/infertypes.js +0 -316
  46. hiplot/static/built/plotxy.d.ts +0 -62
  47. hiplot/static/built/plotxy.js +0 -602
  48. hiplot/static/built/plugin.d.ts +0 -38
  49. hiplot/static/built/plugin.js +0 -8
  50. hiplot/static/built/rowsdisplaytable.d.ts +0 -35
  51. hiplot/static/built/rowsdisplaytable.js +0 -284
  52. hiplot/static/built/streamlit_component/hiplot.bundle.js +0 -3
  53. hiplot/static/built/types.d.ts +0 -64
  54. hiplot/static/built/types.js +0 -55
  55. hiplot_mm-0.0.1.dist-info/RECORD +0 -77
  56. {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info/licenses}/LICENSE +0 -0
  57. {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info/licenses}/NOTICE +0 -0
  58. {hiplot_mm-0.0.1.dist-info → hiplot_mm-0.0.3rc0.dist-info}/top_level.txt +0 -0
hiplot/ipython.py CHANGED
@@ -8,11 +8,38 @@ import typing as t
8
8
  import json
9
9
  from pathlib import Path
10
10
 
11
- import IPython.display
12
- from ipykernel.comm import Comm
13
11
  from . import experiment as exp
14
12
  from .render import escapejs, make_experiment_standalone_page
15
13
 
14
+ # Lazy imports for optional dependencies
15
+ if t.TYPE_CHECKING:
16
+ import IPython.display
17
+ from ipykernel.comm import Comm
18
+
19
+
20
+ def _get_ipython_display() -> t.Any:
21
+ """Lazy import of IPython.display with helpful error message."""
22
+ try:
23
+ import IPython.display
24
+ return IPython.display
25
+ except ImportError as e:
26
+ raise ImportError(
27
+ "IPython is required for notebook support. "
28
+ "Install it with: pip install hiplot-mm[notebook]"
29
+ ) from e
30
+
31
+
32
+ def _get_comm_class() -> t.Any:
33
+ """Lazy import of ipykernel.comm.Comm with helpful error message."""
34
+ try:
35
+ from ipykernel.comm import Comm
36
+ return Comm
37
+ except ImportError as e:
38
+ raise ImportError(
39
+ "ipykernel is required for notebook support. "
40
+ "Install it with: pip install hiplot-mm[notebook]"
41
+ ) from e
42
+
16
43
 
17
44
  class GetSelectedFailure(Exception):
18
45
  pass
@@ -27,8 +54,9 @@ class NotebookJSBundleInjector:
27
54
 
28
55
  @classmethod
29
56
  def ensure_injected(cls) -> None:
57
+ IPython_display = _get_ipython_display()
30
58
  bundle = Path(__file__).parent / "static" / "built" / "hiplot.bundle.js"
31
- IPython.display.display(IPython.display.Javascript(f"""
59
+ IPython_display.display(IPython_display.Javascript(f"""
32
60
  {bundle.read_text("utf-8")}
33
61
  // Local variables can't be accessed in other cells, so let's
34
62
  // manually create a global variable
@@ -76,7 +104,9 @@ class IPythonExperimentDisplayed(exp.ExperimentDisplayed):
76
104
  self._selected_ids: t.List[str] = []
77
105
  self._last_data_per_type: t.Dict[str, t.Any] = {}
78
106
 
79
- def target_func(comm: Comm, open_msg: t.Dict[str, t.Any]) -> None: # pylint: disable=unused-argument
107
+ Comm = _get_comm_class()
108
+
109
+ def target_func(comm: "Comm", open_msg: t.Dict[str, t.Any]) -> None: # pylint: disable=unused-argument
80
110
  # comm is the kernel Comm instance
81
111
  # msg is the comm_open message
82
112
 
@@ -89,7 +119,7 @@ class IPythonExperimentDisplayed(exp.ExperimentDisplayed):
89
119
  self._last_data_per_type[msg_data["type"]] = msg_data["data"]
90
120
 
91
121
  try:
92
- ip: Any = get_ipython() # type: ignore # pylint: disable=undefined-variable
122
+ ip: t.Any = get_ipython() # type: ignore # pylint: disable=undefined-variable
93
123
  ip.kernel.comm_manager.register_target(comm_name, target_func)
94
124
  except NameError: # NameError: name 'get_ipython' is not defined
95
125
  # We are not in an ipython environment - for example in testing
@@ -133,6 +163,8 @@ def display_exp(
133
163
  embed_js_with_html: t.Optional[bool] = None,
134
164
  **kwargs: t.Any
135
165
  ) -> IPythonExperimentDisplayed:
166
+ IPython_display = _get_ipython_display()
167
+
136
168
  if embed_js_with_html is None:
137
169
  embed_js_with_html = _should_embed_js_with_html()
138
170
 
@@ -185,5 +217,5 @@ catch(err) {{
185
217
  else:
186
218
  NotebookJSBundleInjector.ensure_injected()
187
219
 
188
- IPython.display.display(IPython.display.HTML(index_html))
220
+ IPython_display.display(IPython_display.HTML(index_html))
189
221
  return displayed_xp
hiplot/pkginfo.py CHANGED
@@ -2,5 +2,21 @@
2
2
  # This source code is licensed under the MIT license found in the
3
3
  # LICENSE file in the root directory of this source tree.
4
4
 
5
- version = "0.0.0" # Set by CI upon deploy
6
- package_name = "hiplot"
5
+ package_name = "hiplot-mm"
6
+
7
+ # Dynamic version from installed package metadata
8
+ # This ensures __version__ matches pyproject.toml when installed via pip
9
+ try:
10
+ from importlib.metadata import version, PackageNotFoundError
11
+ try:
12
+ version = version(package_name)
13
+ except PackageNotFoundError:
14
+ # Package is not installed (e.g., running from source checkout)
15
+ version = "0.0.0.dev0"
16
+ except ImportError:
17
+ # Python < 3.8 fallback
18
+ try:
19
+ import importlib_metadata
20
+ version = importlib_metadata.version(package_name)
21
+ except Exception:
22
+ version = "0.0.0.dev0"
hiplot/server.py CHANGED
@@ -18,8 +18,14 @@ def run_server(fetchers: List[exp.ExperimentFetcher], host: str = '127.0.0.1', p
18
18
  """
19
19
  Runs the HiPlot server, given a list of ExperimentFetchers - functions that convert a URI into a :class:`hiplot.Experiment`
20
20
  """
21
- from flask import Flask, render_template, jsonify, request
22
- from flask_compress import Compress
21
+ try:
22
+ from flask import Flask, render_template, jsonify, request
23
+ from flask_compress import Compress
24
+ except ImportError as e:
25
+ raise ImportError(
26
+ "Flask is required to run the HiPlot server. "
27
+ "Install it with: pip install hiplot-mm[server]"
28
+ ) from e
23
29
 
24
30
  app = Flask(__name__)
25
31