solara 1.25.0__py2.py3-none-any.whl → 1.25.1__py2.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 (34) hide show
  1. solara/__init__.py +1 -1
  2. solara/__main__.py +1 -1
  3. solara/cache.py +9 -4
  4. solara/checks.py +9 -4
  5. solara/minisettings.py +1 -1
  6. solara/server/assets/style.css +1545 -0
  7. solara/server/flask.py +1 -1
  8. solara/server/kernel.py +3 -3
  9. solara/server/patch.py +2 -0
  10. solara/server/reload.py +1 -1
  11. solara/server/server.py +57 -0
  12. solara/server/starlette.py +8 -9
  13. solara/server/static/solara_bootstrap.py +1 -1
  14. solara/server/telemetry.py +5 -2
  15. solara/server/templates/loader-plain.html +1 -1
  16. solara/server/templates/loader-solara.html +1 -1
  17. solara/server/templates/solara.html.j2 +20 -25
  18. solara/util.py +14 -1
  19. solara/website/pages/apps/jupyter-dashboard-1.py +10 -12
  20. solara/website/pages/apps/scatter.py +4 -4
  21. solara/website/pages/doc_use_download.py +1 -1
  22. solara/website/pages/docs/content/04-tutorial/_jupyter_dashboard_1.ipynb +8 -8
  23. solara/website/pages/docs/content/10-howto/ipywidget_libraries.md +1 -1
  24. solara/website/pages/docs/content/95-changelog.md +8 -0
  25. solara/website/public/success.html +16 -7
  26. solara/website/templates/index.html.j2 +16 -15
  27. {solara-1.25.0.dist-info → solara-1.25.1.dist-info}/METADATA +9 -9
  28. {solara-1.25.0.dist-info → solara-1.25.1.dist-info}/RECORD +33 -34
  29. {solara-1.25.0.dist-info → solara-1.25.1.dist-info}/WHEEL +1 -1
  30. solara/server/assets/index.css +0 -14480
  31. {solara-1.25.0.data → solara-1.25.1.data}/data/prefix/etc/jupyter/jupyter_notebook_config.d/solara.json +0 -0
  32. {solara-1.25.0.data → solara-1.25.1.data}/data/prefix/etc/jupyter/jupyter_server_config.d/solara.json +0 -0
  33. {solara-1.25.0.dist-info → solara-1.25.1.dist-info}/entry_points.txt +0 -0
  34. {solara-1.25.0.dist-info → solara-1.25.1.dist-info}/licenses/LICENSE +0 -0
solara/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  """Build webapps using IPywidgets"""
2
- __version__ = "1.25.0"
2
+ __version__ = "1.25.1"
3
3
  github_url = "https://github.com/widgetti/solara"
4
4
  git_branch = "master"
5
5
 
solara/__main__.py CHANGED
@@ -86,7 +86,7 @@ def _check_version():
86
86
  def find_all_packages_paths():
87
87
  paths = []
88
88
  # sitepackages = set([os.path.dirname(k) for k in site.getsitepackages()])
89
- sitepackages = set([k for k in site.getsitepackages()])
89
+ sitepackages = {k for k in site.getsitepackages()}
90
90
  paths.extend(list(sitepackages))
91
91
  for name, module in sys.modules.items():
92
92
  if hasattr(module, "__path__"):
solara/cache.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import hashlib
2
2
  import inspect
3
3
  import logging
4
+ import sys
4
5
  from typing import (
5
6
  Any,
6
7
  Callable,
@@ -15,12 +16,11 @@ from typing import (
15
16
  )
16
17
 
17
18
  import cachetools
18
- import typing_extensions
19
- from reacton.utils import equals
20
-
21
19
  import solara
22
20
  import solara.settings
23
21
  import solara.util
22
+ import typing_extensions
23
+ from reacton.utils import equals
24
24
 
25
25
  logger = logging.getLogger("solara.cache")
26
26
 
@@ -59,7 +59,12 @@ class MemoizedFunction(Generic[P, R]):
59
59
  nonlocals = inspect.getclosurevars(f).nonlocals
60
60
  if nonlocals:
61
61
  raise ValueError(f"Memoized functions cannot depend on nonlocal variables, it now depends on {nonlocals}")
62
- codehash = hashlib.md5(f.__code__.co_code).hexdigest()
62
+ if sys.version_info[:2] < (3, 9):
63
+ # usedforsecurity is only available in Python 3.9+
64
+ codehash = hashlib.md5(f.__code__.co_code).hexdigest()
65
+ else:
66
+ codehash = hashlib.md5(f.__code__.co_code, usedforsecurity=False).hexdigest() # type: ignore
67
+
63
68
  self.function_key = (f.__qualname__, codehash)
64
69
  current_globals = dict(inspect.getclosurevars(f).globals)
65
70
  _global_values_used.setdefault(self.function_key, current_globals)
solara/checks.py CHANGED
@@ -19,6 +19,7 @@ logger = logging.getLogger(__name__)
19
19
 
20
20
  jupyter_checked_path = get_solara_home() / ".jupyter_checked"
21
21
  solara_checked_path = get_solara_home() / ".solara_checked"
22
+ solara_version = solara.__version__
22
23
 
23
24
 
24
25
  def _should_perform_check(path: Path):
@@ -67,12 +68,12 @@ def JupyterCheck():
67
68
  # if the widgets do not work
68
69
  IPython.display.display(
69
70
  IPython.display.Javascript(
70
- data="""
71
+ data=f"""
71
72
  const prevIframe = document.getElementById("solara-jupyter-check");
72
73
  if(prevIframe)
73
74
  prevIframe.remove();
74
75
  const iframe = document.createElement('iframe')
75
- iframe.setAttribute("src", "https://solara.dev/static/public/success.html?check=purejs");
76
+ iframe.setAttribute("src", "https://solara.dev/static/public/success.html?check=purejs&version={solara_version}");
76
77
  iframe.style.width = "0px";
77
78
  iframe.style.height = "0px";
78
79
  iframe.style.display = "none";
@@ -95,7 +96,7 @@ document.body.appendChild(iframe);
95
96
  # this iframe should only get through if the widget installation succeeded
96
97
  return solara.v.Html(
97
98
  tag="iframe",
98
- attributes={"src": "https://solara.dev/static/public/success.html?check=widget", "width": "0px", "height": "0px"},
99
+ attributes={"src": f"https://solara.dev/static/public/success.html?check=widget&version={solara_version}", "width": "0px", "height": "0px"},
99
100
  style_="display: none;",
100
101
  )
101
102
 
@@ -111,7 +112,11 @@ def SolaraCheck():
111
112
  solara.use_effect(flag_solara_checked, [])
112
113
  return solara.v.Html(
113
114
  tag="iframe",
114
- attributes={"src": "https://solara.dev/static/public/success.html?system=solara&check=widget", "width": "0px", "height": "0px"},
115
+ attributes={
116
+ "src": f"https://solara.dev/static/public/success.html?system=solara&check=widget&version={solara_version}",
117
+ "width": "0px",
118
+ "height": "0px",
119
+ },
115
120
  style_="display: none;",
116
121
  )
117
122
 
solara/minisettings.py CHANGED
@@ -94,7 +94,7 @@ class BaseSettings:
94
94
  def __init__(self, **kwargs) -> None:
95
95
  cls = type(self)
96
96
  self._values = {**kwargs}
97
- keys = set([k.upper() for k in os.environ.keys()])
97
+ keys = {k.upper() for k in os.environ.keys()}
98
98
  for key, field in cls.__dict__.items():
99
99
  if key in kwargs:
100
100
  continue