dara-core 1.16.6a2__py3-none-any.whl → 1.16.7__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/cli.py CHANGED
@@ -136,6 +136,10 @@ def start(
136
136
  # Ensure the base_url is set as an env var as well
137
137
  if base_url:
138
138
  os.environ['DARA_BASE_URL'] = base_url
139
+ os.environ['VITE_STATIC_URL'] = f'{base_url}/static/'
140
+ else:
141
+ # Needs to match where the static files are mounted at in the router
142
+ os.environ['VITE_STATIC_URL'] = '/static/'
139
143
 
140
144
  # Check that if production/dev mode is set, node is installed - unless we're in docker mode, or explicitly skipping jsbuild
141
145
  if not docker and not skip_jsbuild and (production or enable_hmr):
@@ -144,9 +148,6 @@ def start(
144
148
  if exit_code > 0:
145
149
  raise SystemError('NodeJS is required in production mode.')
146
150
 
147
- # Needs to match where the static files are mounted at in the router
148
- os.environ['STATIC_URL'] = '/static/'
149
-
150
151
  logging_config = os.path.join(LOG_CONFIG_PATH, 'logging.yaml')
151
152
 
152
153
  os.environ['DARA_DEBUG_LOG_LEVEL'] = debug or 'NONE'
@@ -1,10 +1,23 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <title>decisionApp</title>
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <link id="favicon" rel="icon" type="image/x-icon" href="/static/favicon.ico" />
7
+ <link id="favicon" rel="icon" type="image/x-icon" href="{{ static_url }}/favicon.ico" />
8
+
9
+ <script>
10
+ window.dara = {
11
+ base_url: "{{ base_url }}",
12
+ // static_url can be relative or absolute depending on how the backend is configured.
13
+ static_url: "{{ static_url }}",
14
+ };
15
+
16
+ // Setup the javascript hook for getting the current value.
17
+ window.__toDaraUrl = (filename) => `${window.dara.static_url}${filename}`;
18
+ </script>
19
+
20
+ <base href="{{ base_url }}" />
8
21
 
9
22
  <!-- jQuery is required for i.e. bokeh; due to bundling issues it needs to be included as UMD -->
10
23
  <script
@@ -12,6 +12,10 @@
12
12
  crossorigin="anonymous"
13
13
  ></script>
14
14
 
15
+ <script>
16
+ window.dara = {base_url: "$$baseUrl$$"};
17
+ </script>
18
+
15
19
  <!-- React/styled-components are included as UMD as they are not bundled inside each module -->
16
20
  <script crossorigin src="https://unpkg.com/react@18.2.0/umd/react.development.js"></script>
17
21
  <script crossorigin src="https://unpkg.com/react-dom@18.2.0/umd/react-dom.development.js"></script>
@@ -402,6 +402,13 @@ def _py_version_to_js(package_name: str) -> str:
402
402
  # Handle pre releases (a|b|c|rc|alpha|beta|pre|preview)
403
403
  if parsed_version.is_prerelease and parsed_version.pre is not None:
404
404
  pre_name, pre_version = parsed_version.pre
405
+
406
+ # js names created are full alpha/beta
407
+ if pre_name == 'a':
408
+ pre_name = 'alpha'
409
+ elif pre_name == 'b':
410
+ pre_name = 'beta'
411
+
405
412
  return f'{parsed_version.base_version}-{pre_name}.{pre_version}'
406
413
 
407
414
  # Handle dev releases (dev)
@@ -627,10 +634,8 @@ def build_autojs_template(html_template: str, build_cache: BuildCache, config: C
627
634
  for name, _ in importers_dict.items():
628
635
  importers_out += f'"{name}": () => Promise.resolve({name}),'
629
636
  importers_out = f'{importers_out[:-1]}}}'
630
- start_script = (
631
- entry_template_str.replace('$$importers$$', importers_out)
632
- .replace('$$baseUrl$$', settings.dara_base_url)
633
- .replace('$$extraJs$$', config.template_extra_js + '\n' + settings.dara_template_extra_js)
637
+ start_script = entry_template_str.replace('$$importers$$', importers_out).replace(
638
+ '$$extraJs$$', config.template_extra_js + '\n' + settings.dara_template_extra_js
634
639
  )
635
640
 
636
641
  package_tags: Dict[str, List[str]] = {
@@ -670,4 +675,4 @@ def build_autojs_template(html_template: str, build_cache: BuildCache, config: C
670
675
  f'<link id="favicon" rel="icon" type="image/x-icon" href="{settings.dara_base_url}/static/favicon.ico"></link>'
671
676
  )
672
677
 
673
- return html_template.replace('$$assets$$', '\n'.join(tags))
678
+ return html_template.replace('$$assets$$', '\n'.join(tags)).replace('$$baseUrl$$', settings.dara_base_url)
@@ -4,5 +4,5 @@
4
4
  window.onload = function () {
5
5
  $$extraJs$$;
6
6
 
7
- dara.core['default']($$importers$$, '$$baseUrl$$');
7
+ dara.core['default']($$importers$$);
8
8
  };
@@ -2,7 +2,7 @@ import react from '@vitejs/plugin-react';
2
2
  import { defineConfig } from 'vite';
3
3
 
4
4
  export default defineConfig({
5
- base: '/static/',
5
+ base: '',
6
6
  plugins: [
7
7
  react({
8
8
  jsxRuntime: 'classic',
@@ -17,6 +17,14 @@ export default defineConfig({
17
17
  input: './_entry.tsx',
18
18
  },
19
19
  },
20
+ experimental: {
21
+ renderBuiltUrl(filename, { hostType }) {
22
+ if (hostType !== 'css') {
23
+ return { runtime: `window.__toDaraUrl(${JSON.stringify(filename)})` };
24
+ }
25
+ return { relative: true };
26
+ },
27
+ },
20
28
  server: {
21
29
  // Root of assets served in DEV mode
22
30
  origin: 'http://localhost:3000',
dara/core/main.py CHANGED
@@ -97,6 +97,8 @@ def _start_application(config: Configuration):
97
97
  jinja_templates = Jinja2Templates(directory=str((Path(BASE_DIR, 'jinja'))))
98
98
  jinja_templates.env.globals['vite_hmr_client'] = fastapi_vite_dara.vite_hmr_client
99
99
  jinja_templates.env.globals['vite_asset'] = fastapi_vite_dara.vite_asset
100
+ jinja_templates.env.globals['static_url'] = fastapi_vite_dara.config.settings.static_url
101
+ jinja_templates.env.globals['base_url'] = os.getenv('DARA_BASE_URL', '')
100
102
  jinja_templates.env.globals['entry'] = '_entry.tsx'
101
103
 
102
104
  # If --enable-hmr or --reload enabled, set live reload to true
@@ -60311,12 +60311,8 @@ Inferred class string: "${iconClasses}."`
60311
60311
 
60312
60312
  background-color: ${(props) => props.backgroundColor};
60313
60313
  `;
60314
- function run(importers, baseUrl) {
60314
+ function run(importers) {
60315
60315
  const queryClient = new reactQuery.QueryClient();
60316
- window.dara = {
60317
- ...window.dara,
60318
- base_url: baseUrl != null ? baseUrl : ""
60319
- };
60320
60316
  let basename = "";
60321
60317
  if (window.dara.base_url !== "") {
60322
60318
  basename = new URL(window.dara.base_url, window.origin).pathname;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dara-core
3
- Version: 1.16.6a2
3
+ Version: 1.16.7
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.6-alpha.2)
23
+ Requires-Dist: create-dara-app (==1.16.7)
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.6-alpha.2) ; extra == "all"
26
+ Requires-Dist: dara-components (==1.16.7) ; 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)
@@ -52,7 +52,7 @@ Description-Content-Type: text/markdown
52
52
 
53
53
  # Dara Application Framework
54
54
 
55
- <img src="https://github.com/causalens/dara/blob/v1.16.6-alpha.2/img/dara_light.svg?raw=true">
55
+ <img src="https://github.com/causalens/dara/blob/v1.16.7/img/dara_light.svg?raw=true">
56
56
 
57
57
  ![Master tests](https://github.com/causalens/dara/actions/workflows/tests.yml/badge.svg?branch=master)
58
58
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
@@ -97,7 +97,7 @@ source .venv/bin/activate
97
97
  dara start
98
98
  ```
99
99
 
100
- ![Dara App](https://github.com/causalens/dara/blob/v1.16.6-alpha.2/img/components_gallery.png?raw=true)
100
+ ![Dara App](https://github.com/causalens/dara/blob/v1.16.7/img/components_gallery.png?raw=true)
101
101
 
102
102
  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:
103
103
 
@@ -114,9 +114,9 @@ Explore some of our favorite apps - a great way of getting started and getting t
114
114
 
115
115
  | Dara App | Description |
116
116
  | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
117
- | ![Large Language Model](https://github.com/causalens/dara/blob/v1.16.6-alpha.2/img/llm.png?raw=true) | Demonstrates how to use incorporate a LLM chat box into your decision app to understand model insights |
118
- | ![Plot Interactivity](https://github.com/causalens/dara/blob/v1.16.6-alpha.2/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 |
119
- | ![Graph Editor](https://github.com/causalens/dara/blob/v1.16.6-alpha.2/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. |
117
+ | ![Large Language Model](https://github.com/causalens/dara/blob/v1.16.7/img/llm.png?raw=true) | Demonstrates how to use incorporate a LLM chat box into your decision app to understand model insights |
118
+ | ![Plot Interactivity](https://github.com/causalens/dara/blob/v1.16.7/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 |
119
+ | ![Graph Editor](https://github.com/causalens/dara/blob/v1.16.7/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
120
 
121
121
  Check out our [App Gallery](https://dara.causalens.com/gallery) for more inspiration!
122
122
 
@@ -143,9 +143,9 @@ And the supporting UI packages and tools.
143
143
  - `ui-utils` - miscellaneous utility functions
144
144
  - `ui-widgets` - widget components
145
145
 
146
- More information on the repository structure can be found in the [CONTRIBUTING.md](https://github.com/causalens/dara/blob/v1.16.6-alpha.2/CONTRIBUTING.md) file.
146
+ More information on the repository structure can be found in the [CONTRIBUTING.md](https://github.com/causalens/dara/blob/v1.16.7/CONTRIBUTING.md) file.
147
147
 
148
148
  ## License
149
149
 
150
- Dara is open-source and licensed under the [Apache 2.0 License](https://github.com/causalens/dara/blob/v1.16.6-alpha.2/LICENSE).
150
+ Dara is open-source and licensed under the [Apache 2.0 License](https://github.com/causalens/dara/blob/v1.16.7/LICENSE).
151
151
 
@@ -7,7 +7,7 @@ dara/core/auth/definitions.py,sha256=7SoUBlYQhccop4Rl0XlHjSBjBU41ZbCZHS7Y-fL9g84
7
7
  dara/core/auth/routes.py,sha256=1gOe1Z2Vv5MtpW5uvUYvyYWTJ_BDoLRllji1Plk4nss,7180
8
8
  dara/core/auth/utils.py,sha256=sFQWbkclDi2842mhauTeLh5g5RsSrzS7AxlKSSnzhYM,7320
9
9
  dara/core/base_definitions.py,sha256=6PFJpeHADl518TgkFHrQ7U2442S2RM5fTKkpm6_pAcY,17839
10
- dara/core/cli.py,sha256=2nDBanx4yRF7H-Uxefw3FHLDr1TclxouWJYXnY0B71g,8074
10
+ dara/core/cli.py,sha256=hgzy8zrEB_JR2GF_nBBfs9d2I9LmjJt0OQJYOOCc284,8158
11
11
  dara/core/configuration.py,sha256=MQMWvG_poVRWQV05pv2zjXkM8cUPxVTYts0H0Pf7F5o,21228
12
12
  dara/core/css.py,sha256=KWCJTPpx4tTezP9VJO3k-RSVhWwomJr-4USoLz9vNAs,1771
13
13
  dara/core/data_utils.py,sha256=5GGz4vk6srLO8HMySiAEk_xZCvmf0SeTTgVi-N4qaKY,12636
@@ -61,27 +61,27 @@ dara/core/internal/store.py,sha256=kLRDuYEFwqpJMS0CmL5jGmETs645Xcug4jlelJqk5w4,7
61
61
  dara/core/internal/tasks.py,sha256=oCfmOMm3pVH0-dvZzJv4nspCRWc_u-J3J7lmNI_ys5E,24763
62
62
  dara/core/internal/utils.py,sha256=b1YYkn8qHl6-GY6cCm2MS1NXRS9j_rElYCKMZOxJgrY,8232
63
63
  dara/core/internal/websocket.py,sha256=qeW7KOeJ_FPkpAJNZaVwxIN_DqDv7XK7uyjTxJ8HIno,22043
64
- dara/core/jinja/index.html,sha256=iykqiRh3H_HkcjHJeeSRXRu45nZ2y1sZX5FLdPRhlQY,726
65
- dara/core/jinja/index_autojs.html,sha256=MRF5J0vNfzZQm9kPEeLl23sbr08fVSRd_PAUD6Fkc_0,1253
64
+ dara/core/jinja/index.html,sha256=1gkCFiihXOUH7vp7tT5gH8mKeJB4KqNg394xO3a0usI,1208
65
+ dara/core/jinja/index_autojs.html,sha256=u1diDUnRT4djZqN1T6lIE01GhlfL6SJ_yLYcyapruss,1342
66
66
  dara/core/js_tooling/custom_js_scaffold/index.tsx,sha256=FEzSV5o5Nyzxw6eXvGLi7BkEBkXf3brV34_7ATLnY7o,68
67
67
  dara/core/js_tooling/custom_js_scaffold/local-js-component.tsx,sha256=Ojsyeh9MYJnH_XJXGkSc8PAUZIqJcqcGTu_uRITo_88,709
68
- dara/core/js_tooling/js_utils.py,sha256=cKkUmBrClZOCmra6lzjWoqQy3nRS87UBOelZXpE3tD4,26112
68
+ dara/core/js_tooling/js_utils.py,sha256=4cGo_Zcew0WbKQdlDnR24yqeRsGkbSL2caEIx-5sWKI,26260
69
69
  dara/core/js_tooling/statics/favicon.ico,sha256=CJP26erMMIwQB8FFmyhoUJ-Cx1cXEopiVGxFwyxcpo0,47068
70
70
  dara/core/js_tooling/statics/tsconfig.json,sha256=ubnFjwvPHbx2F7wVWsU2VHLDeEnnOwXkTIk7hLNY8ZM,446
71
71
  dara/core/js_tooling/templates/.npmrc,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
72
72
  dara/core/js_tooling/templates/_entry.template.tsx,sha256=oTeiSLDmq4J-2pM7qjA2RgUocT6Rla7BNwyEAJGvdCc,161
73
- dara/core/js_tooling/templates/_entry_autojs.template.tsx,sha256=OtdXqH4kshaMiTk7E6gvccbVKU1UN-ShRKA9gLpu22E,217
73
+ dara/core/js_tooling/templates/_entry_autojs.template.tsx,sha256=c9eNln0iLHUjhxsgXsF67hPcu4coloh0luvrhdM4ETM,202
74
74
  dara/core/js_tooling/templates/dara.config.json,sha256=RZG_R_xJv_5rYIoz2QZulcG49wD0JURTzshtAzG_di4,84
75
- dara/core/js_tooling/templates/vite.config.template.ts,sha256=f7_DbAQPDq6FJcOFJDnf2bMtzsvGWnN6VclRJjVdql8,631
75
+ dara/core/js_tooling/templates/vite.config.template.ts,sha256=-_GgbqPAcg_rTL2JsWjqYqZa4w6p2fKa2nyqGnjqj18,888
76
76
  dara/core/log_configs/logging.yaml,sha256=YJyD18psAmSVz6587dcEOyoulLuRFFu1g8yMXl1ylM0,706
77
77
  dara/core/logging.py,sha256=QXf8qQDNdh5UW5-jnYwFz7U7KDmhPiZXmObBal_mwPo,13093
78
- dara/core/main.py,sha256=-KxI_gq_0URRbiEyO32wmCyFEy9aL7BM-iE_D9MKlxo,18148
78
+ dara/core/main.py,sha256=7bsmIPzjhnJx6RjcOaFTMKfxRBvnx8RjLjsH5xaQMQc,18326
79
79
  dara/core/metrics/__init__.py,sha256=2UqpWHv-Ie58QLJIHJ9Szfjq8xifAuwy5FYGUIFwWtI,823
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
83
  dara/core/persistence.py,sha256=RaGiGQE3oIzEH7kHC1ZXji2VJa0aP0ewMjt1wRWYWjI,10634
84
- dara/core/umd/dara.core.umd.js,sha256=FBnnemgLY__jKGJbCKJ3PL7W5Mi3hHxu_F69qIRyWZ0,4869427
84
+ dara/core/umd/dara.core.umd.js,sha256=Ctt85jvKT_3vIdLI77j31IplDWcGBecQN2KKALPgzRc,4869322
85
85
  dara/core/umd/style.css,sha256=YQtQ4veiSktnyONl0CU1iU1kKfcQhreH4iASi1MP7Ak,4095007
86
86
  dara/core/visual/__init__.py,sha256=QN0wbG9HPQ_vXh8BO8DnBXeYLIENVTNtRmYzZf1lx7c,577
87
87
  dara/core/visual/components/__init__.py,sha256=4km21GLMLM2cr42SwehLUD7DJOlzvhwHl5hdG1OqmIM,2274
@@ -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.6a2.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
108
- dara_core-1.16.6a2.dist-info/METADATA,sha256=f2r9zhape_HLkIjE0Ab-i7O_r2-r9FmlVVGBnPLd0pU,7514
109
- dara_core-1.16.6a2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
110
- dara_core-1.16.6a2.dist-info/entry_points.txt,sha256=H__D5sNIGuPIhVam0DChNL-To5k8Y7nY7TAFz9Mz6cc,139
111
- dara_core-1.16.6a2.dist-info/RECORD,,
107
+ dara_core-1.16.7.dist-info/LICENSE,sha256=r9u1w2RvpLMV6YjuXHIKXRBKzia3fx_roPwboGcLqCc,10944
108
+ dara_core-1.16.7.dist-info/METADATA,sha256=jDInGxGz9afmNnZwyaHr5eaC-MtCwv9AvDIL1qtrgCc,7440
109
+ dara_core-1.16.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
110
+ dara_core-1.16.7.dist-info/entry_points.txt,sha256=H__D5sNIGuPIhVam0DChNL-To5k8Y7nY7TAFz9Mz6cc,139
111
+ dara_core-1.16.7.dist-info/RECORD,,