dara-core 1.21.23__py3-none-any.whl → 1.21.24__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.
@@ -34,6 +34,7 @@ from .fallback import (
34
34
  )
35
35
  from .for_cmp import For, ForDef
36
36
  from .invalid_component import InvalidComponent
37
+ from .match_cmp import Match, MatchDef
37
38
  from .menu import Menu, MenuDef
38
39
  from .powered_by_causalens import PoweredByCausalens, PoweredByCausalensDef
39
40
  from .progress_tracker import (
@@ -52,6 +53,8 @@ __all__ = [
52
53
  'InvalidComponent',
53
54
  'ProgressTracker',
54
55
  'ProgressTrackerDef',
56
+ 'Match',
57
+ 'MatchDef',
55
58
  'Menu',
56
59
  'MenuDef',
57
60
  'For',
@@ -0,0 +1,46 @@
1
+ from dara.core.definitions import ComponentInstance, JsComponentDef
2
+ from dara.core.interactivity.client_variable import ClientVariable
3
+
4
+ MatchDef = JsComponentDef(name='Match', js_module='@darajs/core', py_module='dara.core')
5
+
6
+
7
+ class Match(ComponentInstance):
8
+ """
9
+ The Match component allows the children to be rendered based on a value, at runtime in the JS code.
10
+ The component then accepts a map of primitive values to children and a a default children set.
11
+
12
+ An Match component is created like so, in this example it is comparing the enum value of a variable:
13
+
14
+ ```python
15
+ from enum import StrEnum
16
+ from dara.core import Variable, Match
17
+ from dara.components import Text
18
+
19
+ class Status(StrEnum):
20
+ OK = 'OK'
21
+ ERROR = 'ERROR'
22
+ WARNING = 'WARNING'
23
+
24
+ var_status = Variable[Status](Status.OK)
25
+
26
+ Match(
27
+ value=var_status,
28
+ when={
29
+ Status.OK: Text('OK'),
30
+ Status.ERROR: Text('ERROR'),
31
+ Status.WARNING: Text('WARNING'),
32
+ },
33
+ default=Text('Unknown status')
34
+ )
35
+ ```
36
+
37
+ Note that in simple cases this could simply be written using `SwitchVariable.match` instead. `Match` is useful when you want to display different components based on a variable value.
38
+
39
+ :param value: a value to match against
40
+ :param when: a map of primitive values to children
41
+ :param default: children to display when the value is not matched, defaults to nothing rendered if not passed
42
+ """
43
+
44
+ value: ClientVariable
45
+ when: dict[str | int | float, ComponentInstance | None]
46
+ default: ComponentInstance | None = None
@@ -48,6 +48,9 @@ Dark = ThemeDef(
48
48
  teal='#00849F',
49
49
  orange='#DB6D5E',
50
50
  plum='#AB2178',
51
+ carrot='#E48015',
52
+ kale='#277357',
53
+ chestnut='#974741',
51
54
  error='#CA456F',
52
55
  errorHover='#D1567E',
53
56
  errorDown='#D7688B',
@@ -50,6 +50,9 @@ class ThemeColors(BaseModel):
50
50
  teal: str | None = None
51
51
  orange: str | None = None
52
52
  plum: str | None = None
53
+ carrot: str | None = None
54
+ kale: str | None = None
55
+ chestnut: str | None = None
53
56
  error: str | None = None
54
57
  errorHover: str | None = None
55
58
  errorDown: str | None = None
@@ -48,6 +48,9 @@ Light = ThemeDef(
48
48
  teal='#0790AE',
49
49
  orange='#FF8F80',
50
50
  plum='#BA3C8B',
51
+ carrot='#E48015',
52
+ kale='#277357',
53
+ chestnut='#974741',
51
54
  error='#DA6087',
52
55
  errorHover='#D14975',
53
56
  errorDown='#C33462',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dara-core
3
- Version: 1.21.23
3
+ Version: 1.21.24
4
4
  Summary: Dara Framework Core
5
5
  Home-page: https://dara.causalens.com/
6
6
  License: Apache-2.0
@@ -21,10 +21,10 @@ Requires-Dist: cachetools (>=5.0.0,<6.0.0)
21
21
  Requires-Dist: certifi (>=2024.7.4)
22
22
  Requires-Dist: click (>=8.1.3,<9.0.0)
23
23
  Requires-Dist: colorama (>=0.4.6,<0.5.0)
24
- Requires-Dist: create-dara-app (==1.21.23)
24
+ Requires-Dist: create-dara-app (==1.21.24)
25
25
  Requires-Dist: croniter (>=6.0.0,<7.0.0)
26
26
  Requires-Dist: cryptography (>=42.0.4)
27
- Requires-Dist: dara-components (==1.21.23) ; extra == "all"
27
+ Requires-Dist: dara-components (==1.21.24) ; extra == "all"
28
28
  Requires-Dist: exceptiongroup (>=1.1.3,<2.0.0)
29
29
  Requires-Dist: fastapi (>=0.115.0,<0.121.0)
30
30
  Requires-Dist: fastapi_vite_dara (==0.4.0)
@@ -55,7 +55,7 @@ Description-Content-Type: text/markdown
55
55
 
56
56
  # Dara Application Framework
57
57
 
58
- <img src="https://github.com/causalens/dara/blob/v1.21.23/img/dara_light.svg?raw=true">
58
+ <img src="https://github.com/causalens/dara/blob/v1.21.24/img/dara_light.svg?raw=true">
59
59
 
60
60
  ![Master tests](https://github.com/causalens/dara/actions/workflows/tests.yml/badge.svg?branch=master)
61
61
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
@@ -100,7 +100,7 @@ source .venv/bin/activate
100
100
  dara start
101
101
  ```
102
102
 
103
- ![Dara App](https://github.com/causalens/dara/blob/v1.21.23/img/components_gallery.png?raw=true)
103
+ ![Dara App](https://github.com/causalens/dara/blob/v1.21.24/img/components_gallery.png?raw=true)
104
104
 
105
105
  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:
106
106
 
@@ -117,9 +117,9 @@ Explore some of our favorite apps - a great way of getting started and getting t
117
117
 
118
118
  | Dara App | Description |
119
119
  | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
120
- | ![Large Language Model](https://github.com/causalens/dara/blob/v1.21.23/img/llm.png?raw=true) | Demonstrates how to use incorporate a LLM chat box into your decision app to understand model insights |
121
- | ![Plot Interactivity](https://github.com/causalens/dara/blob/v1.21.23/img/plot_interactivity.png?raw=true) | 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 |
122
- | ![Graph Editor](https://github.com/causalens/dara/blob/v1.21.23/img/graph_viewer.png?raw=true) | 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. |
120
+ | ![Large Language Model](https://github.com/causalens/dara/blob/v1.21.24/img/llm.png?raw=true) | Demonstrates how to use incorporate a LLM chat box into your decision app to understand model insights |
121
+ | ![Plot Interactivity](https://github.com/causalens/dara/blob/v1.21.24/img/plot_interactivity.png?raw=true) | 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 |
122
+ | ![Graph Editor](https://github.com/causalens/dara/blob/v1.21.24/img/graph_viewer.png?raw=true) | 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. |
123
123
 
124
124
  Check out our [App Gallery](https://dara.causalens.com/gallery) for more inspiration!
125
125
 
@@ -146,9 +146,9 @@ And the supporting UI packages and tools.
146
146
  - `ui-utils` - miscellaneous utility functions
147
147
  - `ui-widgets` - widget components
148
148
 
149
- More information on the repository structure can be found in the [CONTRIBUTING.md](https://github.com/causalens/dara/blob/v1.21.23/CONTRIBUTING.md) file.
149
+ More information on the repository structure can be found in the [CONTRIBUTING.md](https://github.com/causalens/dara/blob/v1.21.24/CONTRIBUTING.md) file.
150
150
 
151
151
  ## License
152
152
 
153
- Dara is open-source and licensed under the [Apache 2.0 License](https://github.com/causalens/dara/blob/v1.21.23/LICENSE).
153
+ Dara is open-source and licensed under the [Apache 2.0 License](https://github.com/causalens/dara/blob/v1.21.24/LICENSE).
154
154
 
@@ -6,15 +6,15 @@ dara/core/auth/basic.py,sha256=sglIaogCslG2HlDMjFsaaJhOJeXUW-QQLTIYPaUPxAU,4927
6
6
  dara/core/auth/definitions.py,sha256=DWvhvXTLQyJ0x-P_r4SycVOWht7R_us_ca2a4biJlTY,3379
7
7
  dara/core/auth/routes.py,sha256=dtOxpFotnt4XQ4spW3mbyM7ThYRvfIA_oRK5X5lyYHg,7256
8
8
  dara/core/auth/utils.py,sha256=12dbakr4DkZu8PjS57YlV79Oh-SVaqkoYliCSAseywQ,7307
9
- dara/core/base_definitions.py,sha256=YY3slxMtyQP-38LojBtjxyTKCcCdE2xEwKBvRTYlhOA,18402
9
+ dara/core/base_definitions.py,sha256=JZWTgAGpnhH6PIcrzgFC-torkoTGzapQ_5bqzKCL-Fs,19108
10
10
  dara/core/cli.py,sha256=i9-Xtdee80b153TSU9fFSWbHQYCi01ci_Lo8SzwnW7M,8130
11
11
  dara/core/configuration.py,sha256=PAxtnIF86kRh3D7DrdB3lxwl2QkA008aKSykvcLGlCE,23353
12
12
  dara/core/css.py,sha256=c1TMGzOcXYIy-qU-TxeirGlq2BNEigP80eDG3ItjRbU,1740
13
13
  dara/core/data_utils.py,sha256=haR-SPCFm90RfOIndPBGOpFtOEmhiJgizmzcqzZOZBg,12455
14
- dara/core/defaults.py,sha256=lmVSGKnc5NQMsBtQArLrb_jI_BBDrgzbNNAvZ5GvKYI,4829
14
+ dara/core/defaults.py,sha256=ejSXYKm78vd0_3b-3x6K8lffU-7BWyEhqQuwdBkkWwU,4884
15
15
  dara/core/definitions.py,sha256=uf8dVhEff9LMBLEK4SaZjod_WP5PH2jnuasni__ZeL8,18010
16
16
  dara/core/http.py,sha256=gFkUV3jBY6lx0ZIIzeFw8zEH6WAb8uIKfo_t8heZDEw,4739
17
- dara/core/interactivity/__init__.py,sha256=uHIKFBs2ifHeM-VxhcSVqr2RgYmo1anuP5lfVcYXTFU,2772
17
+ dara/core/interactivity/__init__.py,sha256=tgPyP6invwQJuSmKvrP5WQI3xtebGLvlm3nkiQ7Fx4g,2855
18
18
  dara/core/interactivity/actions.py,sha256=AOvOGnl0rgf5QYpwccM9kFMiehMSRw84HUSAVHmdZRA,50741
19
19
  dara/core/interactivity/any_data_variable.py,sha256=qnJAgTV_AleBwobz2GovezvX2pXrcSwD18yKQPjt32I,306
20
20
  dara/core/interactivity/any_variable.py,sha256=mOCBW5m1CCM-gzOMlN-rnlAIktb2rZJAPWE-WKiR3-A,13648
@@ -24,7 +24,7 @@ dara/core/interactivity/data_variable.py,sha256=FJ6vtsZ-39C2KrOIaxSnjOBCD0mOHjvu
24
24
  dara/core/interactivity/derived_data_variable.py,sha256=nfHYrd2a4dT7penr2JhPVnHAv3MGpKn1pIIF5mh4xQo,3611
25
25
  dara/core/interactivity/derived_variable.py,sha256=RMZbc1capmj_ceSG45GiQpheNgE1y9TIf8xl08YYHdY,32276
26
26
  dara/core/interactivity/filtering.py,sha256=_F0OtECufYCptRI6h98_vDliG9xcPD5SItlQkjiNqR4,9667
27
- dara/core/interactivity/loop_variable.py,sha256=vA09qhs7DJ7x_4oefhGG0K3MKrpkAnMXviWw2eBi_pU,2953
27
+ dara/core/interactivity/loop_variable.py,sha256=9AvHUuyuneSLJstscv-o8gMd_FMd8p-U8QK5GqsPCVo,3611
28
28
  dara/core/interactivity/non_data_variable.py,sha256=k2yXTowWmH5UhG9iJfYo_bUG7AT5fdKSwX5LcDQ71-4,178
29
29
  dara/core/interactivity/plain_variable.py,sha256=tg4D8UMno5cwGtM4U6FJKPbjhRRk6rZ6hJeiGgbGdrw,13123
30
30
  dara/core/interactivity/server_variable.py,sha256=s1OoLIyWIVF0TAId5Pv3b6ZZpBEHjzTotYQufAYHjZI,11109
@@ -92,15 +92,16 @@ dara/core/router/__init__.py,sha256=yGI_MgLQU37ircCtYVNjnhqCjWQxKd5amoNqvMyrhOs,
92
92
  dara/core/router/compat.py,sha256=B83wq46AwQARTDfZwGrpr0slrnQmi_T7shOUNpqltSM,3112
93
93
  dara/core/router/components.py,sha256=Wsf_bBnnN-1EE5jhbjPSOyDv_TVKEsY4royyOQOazM4,6132
94
94
  dara/core/router/dependency_graph.py,sha256=A0xGuZWSOCGs7rwHbeZC5vLvZouUt-2fnEX9VM2Ukp0,2280
95
- dara/core/router/router.py,sha256=5Nh7ms7ynnUWEV1FuCus-XvGp4NAe4OB1jdS2x5SS7Q,31249
96
- dara/core/umd/dara.core.umd.cjs,sha256=zonfzOidVkoHJ_8lfFcEszljMmUxeVF_9ZY8qU-iLHo,5148440
95
+ dara/core/router/router.py,sha256=M2urCZhZYVdeFXP0cIz44sPO0g9nFvr7vmag-AcvB-I,32251
96
+ dara/core/umd/dara.core.umd.cjs,sha256=PwFjqu0oACOtYKZX288Rp8J9K_sg8JZQgIGIGXbyhJ4,5155098
97
97
  dara/core/umd/style.css,sha256=yT3PKpi2sKI2-kQIF8xtVbTPQqgpK7-Ua7tfzDPuSsI,4095881
98
98
  dara/core/visual/__init__.py,sha256=QN0wbG9HPQ_vXh8BO8DnBXeYLIENVTNtRmYzZf1lx7c,577
99
- dara/core/visual/components/__init__.py,sha256=nmCsnMLXeZAjkhMYz-mIFodpVY-69IO1fvwwXbFlMQ4,2447
99
+ dara/core/visual/components/__init__.py,sha256=Jrh38Q4Lc8iFFVKPuEaDeloYHVLohTTHgK92u1e_ZtY,2515
100
100
  dara/core/visual/components/dynamic_component.py,sha256=F_UxogMQ9I5GB6BLqDmGaojRQyOOmwJBB5kaIk1iPpI,867
101
101
  dara/core/visual/components/fallback.py,sha256=-7lJwqPrm47Xbqs3rYEUw2JXuJRJpd_wYMt7no8uWkE,4746
102
102
  dara/core/visual/components/for_cmp.py,sha256=SxUR0KYYHbLYZqPGesfSM-GSzCBL2eXyqYDlYYLkYdQ,6316
103
103
  dara/core/visual/components/invalid_component.py,sha256=Q6O9rAwVUNZXjEmliAKLfWf2lsyYK5JhgQvMM6jVco8,901
104
+ dara/core/visual/components/match_cmp.py,sha256=hwH38azC3DKgg36OKnM5_LFCrOEXtHN3PV9BkCsqwPA,1623
104
105
  dara/core/visual/components/menu.py,sha256=_Q_aGrCssOe29WFmRfRFOIOpFDn2HEn2TKF2ll_Ddss,1088
105
106
  dara/core/visual/components/menu_link.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
106
107
  dara/core/visual/components/powered_by_causalens.py,sha256=AOeEDKCqRcLhdVDcpcXnAwGupfMvrJo2cZ26q3CYpMc,285
@@ -117,11 +118,11 @@ dara/core/visual/dynamic_component.py,sha256=V1S4HIVpmI4tX-XxvdetnjCcmdcf10YTU_7
117
118
  dara/core/visual/progress_updater.py,sha256=HHY-xNEBoeUVbheYtZ4Yuhi8VHV3SRfygpfOCyBU-U8,5904
118
119
  dara/core/visual/template.py,sha256=1Z-Qv3uctjRtRJnzq-xx5tRBLxFfRGYSCngPrBVbP1I,5651
119
120
  dara/core/visual/themes/__init__.py,sha256=aM4mgoIYo2neBSw5FRzswsht7PUKjLthiHLmFIkyRKw,794
120
- dara/core/visual/themes/dark.py,sha256=UQGDooOc8ric73eHs9E0ltYP4UCrwqQ3QxqN_fb4PwY,1942
121
- dara/core/visual/themes/definitions.py,sha256=jywX4ObSPSW5ppm5mki50L_dPEIeAWweYre1C225STk,2697
122
- dara/core/visual/themes/light.py,sha256=-Tviq8oEwGbdFULoDOqPuHO0UpAZGsBy8qFi0kAGolQ,1944
123
- dara_core-1.21.23.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
124
- dara_core-1.21.23.dist-info/METADATA,sha256=G4yr8A5kaAmu4SzGoTjU1yJnrxxItWluQxn5aSkvVuI,7541
125
- dara_core-1.21.23.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
126
- dara_core-1.21.23.dist-info/entry_points.txt,sha256=H__D5sNIGuPIhVam0DChNL-To5k8Y7nY7TAFz9Mz6cc,139
127
- dara_core-1.21.23.dist-info/RECORD,,
121
+ dara/core/visual/themes/dark.py,sha256=QazCRDqh_SCOyQhdwMkH1wbHf301oL7gCFj91plbLww,2020
122
+ dara/core/visual/themes/definitions.py,sha256=dtET2YUlwXkO6gJ23MqSb8gIq-LxJ343CWsgueWSifM,2787
123
+ dara/core/visual/themes/light.py,sha256=dtHb6Q1HOb5r_AvJfe0vZajikVc-GnBEUrGsTcI5MHA,2022
124
+ dara_core-1.21.24.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
125
+ dara_core-1.21.24.dist-info/METADATA,sha256=t8Z0jFZtJwrHUVXStaaTn4xMUHydpEnmfH06dKLbouo,7541
126
+ dara_core-1.21.24.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
127
+ dara_core-1.21.24.dist-info/entry_points.txt,sha256=H__D5sNIGuPIhVam0DChNL-To5k8Y7nY7TAFz9Mz6cc,139
128
+ dara_core-1.21.24.dist-info/RECORD,,