dara-core 1.16.13__py3-none-any.whl → 1.16.14__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.
- dara/core/persistence.py +25 -13
- {dara_core-1.16.13.dist-info → dara_core-1.16.14.dist-info}/METADATA +10 -10
- {dara_core-1.16.13.dist-info → dara_core-1.16.14.dist-info}/RECORD +6 -6
- {dara_core-1.16.13.dist-info → dara_core-1.16.14.dist-info}/LICENSE +0 -0
- {dara_core-1.16.13.dist-info → dara_core-1.16.14.dist-info}/WHEEL +0 -0
- {dara_core-1.16.13.dist-info → dara_core-1.16.14.dist-info}/entry_points.txt +0 -0
dara/core/persistence.py
CHANGED
|
@@ -18,6 +18,7 @@ from pydantic import (
|
|
|
18
18
|
from dara.core.auth.definitions import USER
|
|
19
19
|
from dara.core.internal.utils import run_user_handler
|
|
20
20
|
from dara.core.internal.websocket import WS_CHANNEL
|
|
21
|
+
from dara.core.logging import dev_logger
|
|
21
22
|
|
|
22
23
|
if TYPE_CHECKING:
|
|
23
24
|
from dara.core.interactivity.plain_variable import Variable
|
|
@@ -264,7 +265,9 @@ class BackendStore(PersistenceStore):
|
|
|
264
265
|
def _register(self):
|
|
265
266
|
"""
|
|
266
267
|
Register this store in the backend store registry.
|
|
267
|
-
|
|
268
|
+
Warns if the uid is not unique, i.e. another store with the same uid already exists.
|
|
269
|
+
|
|
270
|
+
:return: True if the store was registered, False if it was already registered previously
|
|
268
271
|
"""
|
|
269
272
|
from dara.core.internal.registries import backend_store_registry
|
|
270
273
|
|
|
@@ -276,8 +279,10 @@ class BackendStore(PersistenceStore):
|
|
|
276
279
|
store=self,
|
|
277
280
|
),
|
|
278
281
|
)
|
|
279
|
-
|
|
280
|
-
|
|
282
|
+
return True
|
|
283
|
+
except ValueError:
|
|
284
|
+
dev_logger.info(f'BackendStore with uid "{self.uid}" already exists, reusing the same instance')
|
|
285
|
+
return False
|
|
281
286
|
|
|
282
287
|
@property
|
|
283
288
|
def ws_mgr(self) -> 'WebsocketManager':
|
|
@@ -292,26 +297,30 @@ class BackendStore(PersistenceStore):
|
|
|
292
297
|
"""
|
|
293
298
|
return {'store_uid': self.uid, 'value': value}
|
|
294
299
|
|
|
295
|
-
async def _notify_user(self, user_identifier: str, value: Any):
|
|
300
|
+
async def _notify_user(self, user_identifier: str, value: Any, ignore_current_channel: bool = True):
|
|
296
301
|
"""
|
|
297
302
|
Notify a given user about the new value for this store.
|
|
303
|
+
|
|
298
304
|
:param user_identifier: user to notify
|
|
299
305
|
:param value: value to notify about
|
|
306
|
+
:param ignore_current_channel: if True, ignore the current websocket channel
|
|
300
307
|
"""
|
|
301
308
|
return await self.ws_mgr.send_message_to_user(
|
|
302
309
|
user_identifier,
|
|
303
310
|
self._create_msg(value),
|
|
304
|
-
ignore_channel=WS_CHANNEL.get(),
|
|
311
|
+
ignore_channel=WS_CHANNEL.get() if ignore_current_channel else None,
|
|
305
312
|
)
|
|
306
313
|
|
|
307
|
-
async def _notify_global(self, value: Any):
|
|
314
|
+
async def _notify_global(self, value: Any, ignore_current_channel: bool = True):
|
|
308
315
|
"""
|
|
309
316
|
Notify all users about the new value for this store.
|
|
317
|
+
|
|
310
318
|
:param value: value to notify about
|
|
319
|
+
:param ignore_current_channel: if True, ignore the current websocket channel
|
|
311
320
|
"""
|
|
312
321
|
return await self.ws_mgr.broadcast(
|
|
313
322
|
self._create_msg(value),
|
|
314
|
-
ignore_channel=WS_CHANNEL.get(),
|
|
323
|
+
ignore_channel=WS_CHANNEL.get() if ignore_current_channel else None,
|
|
315
324
|
)
|
|
316
325
|
|
|
317
326
|
async def _notify_value(self, value: Any):
|
|
@@ -339,15 +348,18 @@ class BackendStore(PersistenceStore):
|
|
|
339
348
|
|
|
340
349
|
:param variable: the variable to initialize the store for
|
|
341
350
|
"""
|
|
342
|
-
self._register()
|
|
343
351
|
self.default_value = variable.default
|
|
344
352
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
353
|
+
# only if successfully registered, subscribe to the backend - this makes sure we do it once
|
|
354
|
+
if self._register():
|
|
355
|
+
|
|
356
|
+
async def _on_value(key: str, value: Any):
|
|
357
|
+
# here we explicitly DON'T ignore the current channel, in case we created this variable inside e.g. a py_component we want to notify its creator as well
|
|
358
|
+
if user := self._get_user(key):
|
|
359
|
+
return await self._notify_user(user, value, ignore_current_channel=False)
|
|
360
|
+
return await self._notify_global(value, ignore_current_channel=False)
|
|
349
361
|
|
|
350
|
-
|
|
362
|
+
await self.backend.subscribe(_on_value)
|
|
351
363
|
|
|
352
364
|
async def write(self, value: Any, notify=True):
|
|
353
365
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dara-core
|
|
3
|
-
Version: 1.16.
|
|
3
|
+
Version: 1.16.14
|
|
4
4
|
Summary: Dara Framework Core
|
|
5
5
|
Home-page: https://dara.causalens.com/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -20,10 +20,10 @@ Requires-Dist: async-asgi-testclient (>=1.4.11,<2.0.0)
|
|
|
20
20
|
Requires-Dist: certifi (>=2024.7.4)
|
|
21
21
|
Requires-Dist: click (==8.1.3)
|
|
22
22
|
Requires-Dist: colorama (>=0.4.6,<0.5.0)
|
|
23
|
-
Requires-Dist: create-dara-app (==1.16.
|
|
23
|
+
Requires-Dist: create-dara-app (==1.16.14)
|
|
24
24
|
Requires-Dist: croniter (>=1.0.15,<3.0.0)
|
|
25
25
|
Requires-Dist: cryptography (>=42.0.4)
|
|
26
|
-
Requires-Dist: dara-components (==1.16.
|
|
26
|
+
Requires-Dist: dara-components (==1.16.14) ; extra == "all"
|
|
27
27
|
Requires-Dist: exceptiongroup (>=1.1.3,<2.0.0)
|
|
28
28
|
Requires-Dist: fastapi (>=0.115.0,<0.116.0)
|
|
29
29
|
Requires-Dist: fastapi_vite_dara (==0.4.0)
|
|
@@ -53,7 +53,7 @@ Description-Content-Type: text/markdown
|
|
|
53
53
|
|
|
54
54
|
# Dara Application Framework
|
|
55
55
|
|
|
56
|
-
<img src="https://github.com/causalens/dara/blob/v1.16.
|
|
56
|
+
<img src="https://github.com/causalens/dara/blob/v1.16.14/img/dara_light.svg?raw=true">
|
|
57
57
|
|
|
58
58
|

|
|
59
59
|
[](https://www.apache.org/licenses/LICENSE-2.0)
|
|
@@ -98,7 +98,7 @@ source .venv/bin/activate
|
|
|
98
98
|
dara start
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-

|
|
102
102
|
|
|
103
103
|
Note: `pip` installation uses [PEP 660](https://peps.python.org/pep-0660/) `pyproject.toml`-based editable installs which require `pip >= 21.3` and `setuptools >= 64.0.0`. You can upgrade both with:
|
|
104
104
|
|
|
@@ -115,9 +115,9 @@ Explore some of our favorite apps - a great way of getting started and getting t
|
|
|
115
115
|
|
|
116
116
|
| Dara App | Description |
|
|
117
117
|
| -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
118
|
-
|  | Demonstrates how to use incorporate a LLM chat box into your decision app to understand model insights |
|
|
119
|
+
|  | Demonstrates how to enable the user to interact with plots, trigger actions based on clicks, mouse movements and other interactions with `Bokeh` or `Plotly` plots |
|
|
120
|
+
|  | Demonstrates how to use the `CausalGraphViewer` component to display your graphs or networks, customising the displayed information through colors and tooltips, and updating the page based on user interaction. |
|
|
121
121
|
|
|
122
122
|
Check out our [App Gallery](https://dara.causalens.com/gallery) for more inspiration!
|
|
123
123
|
|
|
@@ -144,9 +144,9 @@ And the supporting UI packages and tools.
|
|
|
144
144
|
- `ui-utils` - miscellaneous utility functions
|
|
145
145
|
- `ui-widgets` - widget components
|
|
146
146
|
|
|
147
|
-
More information on the repository structure can be found in the [CONTRIBUTING.md](https://github.com/causalens/dara/blob/v1.16.
|
|
147
|
+
More information on the repository structure can be found in the [CONTRIBUTING.md](https://github.com/causalens/dara/blob/v1.16.14/CONTRIBUTING.md) file.
|
|
148
148
|
|
|
149
149
|
## License
|
|
150
150
|
|
|
151
|
-
Dara is open-source and licensed under the [Apache 2.0 License](https://github.com/causalens/dara/blob/v1.16.
|
|
151
|
+
Dara is open-source and licensed under the [Apache 2.0 License](https://github.com/causalens/dara/blob/v1.16.14/LICENSE).
|
|
152
152
|
|
|
@@ -80,7 +80,7 @@ dara/core/metrics/__init__.py,sha256=2UqpWHv-Ie58QLJIHJ9Szfjq8xifAuwy5FYGUIFwWtI
|
|
|
80
80
|
dara/core/metrics/cache.py,sha256=bGXwjO_rSc-FkS3PnPi1mvIZf1x-hvmG113dAUk1g-Y,2616
|
|
81
81
|
dara/core/metrics/runtime.py,sha256=YP-6Dz0GeI9_Yr7bUk_-OqShyFySGH_AKpDO126l6es,1833
|
|
82
82
|
dara/core/metrics/utils.py,sha256=aKaa_hskV3M3h4xOGZYvegDLq_OWOEUlslkQKrrPQiI,2281
|
|
83
|
-
dara/core/persistence.py,sha256=
|
|
83
|
+
dara/core/persistence.py,sha256=lEyrOfcTDQ2CvlvZZVAuz9fBGwyzjRa3yMw-BBWpOoM,14032
|
|
84
84
|
dara/core/umd/dara.core.umd.js,sha256=zv9FZRX2NtIjgKhiqjzyeFmwuGnkRtxgxFNVfzePAOI,4870020
|
|
85
85
|
dara/core/umd/style.css,sha256=YQtQ4veiSktnyONl0CU1iU1kKfcQhreH4iASi1MP7Ak,4095007
|
|
86
86
|
dara/core/visual/__init__.py,sha256=QN0wbG9HPQ_vXh8BO8DnBXeYLIENVTNtRmYzZf1lx7c,577
|
|
@@ -104,8 +104,8 @@ dara/core/visual/themes/__init__.py,sha256=aM4mgoIYo2neBSw5FRzswsht7PUKjLthiHLmF
|
|
|
104
104
|
dara/core/visual/themes/dark.py,sha256=UQGDooOc8ric73eHs9E0ltYP4UCrwqQ3QxqN_fb4PwY,1942
|
|
105
105
|
dara/core/visual/themes/definitions.py,sha256=nS_gQvOzCt5hTmj74d0_siq_9QWuj6wNuir4VCHy0Dk,2779
|
|
106
106
|
dara/core/visual/themes/light.py,sha256=-Tviq8oEwGbdFULoDOqPuHO0UpAZGsBy8qFi0kAGolQ,1944
|
|
107
|
-
dara_core-1.16.
|
|
108
|
-
dara_core-1.16.
|
|
109
|
-
dara_core-1.16.
|
|
110
|
-
dara_core-1.16.
|
|
111
|
-
dara_core-1.16.
|
|
107
|
+
dara_core-1.16.14.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
|
|
108
|
+
dara_core-1.16.14.dist-info/METADATA,sha256=FZ4vUFZrIFf0k_WCWoLd-m4P8T7BpBVI91dtu-zZMbA,7473
|
|
109
|
+
dara_core-1.16.14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
110
|
+
dara_core-1.16.14.dist-info/entry_points.txt,sha256=H__D5sNIGuPIhVam0DChNL-To5k8Y7nY7TAFz9Mz6cc,139
|
|
111
|
+
dara_core-1.16.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|