nova-trame 0.9.0__py3-none-any.whl → 0.10.1__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.
nova/__init__.py CHANGED
@@ -0,0 +1 @@
1
+ __path__ = __import__("pkgutil").extend_path(__path__, __name__)
@@ -2,9 +2,8 @@
2
2
 
3
3
  import logging
4
4
  import re
5
- from typing import Any, Dict
5
+ from typing import Any, Dict, Optional, Union
6
6
 
7
- from mvvm_lib.pydantic_utils import get_field_info
8
7
  from trame.app import get_server
9
8
  from trame.widgets import client
10
9
  from trame.widgets import vuetify3 as vuetify
@@ -12,6 +11,8 @@ from trame_client.widgets.core import AbstractElement
12
11
  from trame_server.controller import Controller
13
12
  from trame_server.state import State
14
13
 
14
+ from nova.mvvm.pydantic_utils import get_field_info
15
+
15
16
  logger = logging.getLogger(__name__)
16
17
 
17
18
 
@@ -19,24 +20,28 @@ class InputField:
19
20
  """Factory class for generating Vuetify input components."""
20
21
 
21
22
  @staticmethod
22
- def create_boilerplate_properties(v_model: str | None) -> dict:
23
+ def create_boilerplate_properties(v_model: Optional[Union[tuple[str, Any], str]]) -> dict:
23
24
  if not v_model:
24
25
  return {}
25
- object_name_in_state = v_model.split(".")[0]
26
+ if isinstance(v_model, tuple):
27
+ field = v_model[0]
28
+ else:
29
+ field = v_model
30
+ object_name_in_state = field.split(".")[0]
26
31
  field_info = None
27
32
  try:
28
- field_name = ".".join(v_model.split(".")[1:])
33
+ field_name = ".".join(field.split(".")[1:])
29
34
  if "[" in field_name:
30
35
  index_field_name = re.sub(r"\[.*?\]", "[0]", field_name)
31
36
  field_info = get_field_info(f"{object_name_in_state}.{index_field_name}")
32
37
  if "[" in field_name and "[index]" not in field_name:
33
38
  field_info = None
34
39
  logger.warning(
35
- f"{v_model}: validation ignored. We currently only "
40
+ f"{field}: validation ignored. We currently only "
36
41
  f"support single loop with index variable that should be called 'index'"
37
42
  )
38
43
  else:
39
- field_info = get_field_info(v_model)
44
+ field_info = get_field_info(field)
40
45
  except Exception as _:
41
46
  pass
42
47
  label = ""
@@ -58,17 +63,24 @@ class InputField:
58
63
  }
59
64
  if field_info:
60
65
  args |= {
61
- "rules": (f"[(v) => trigger('validate_pydantic_field', ['{v_model}', v, index])]",),
66
+ "rules": (f"[(v) => trigger('validate_pydantic_field', ['{field}', v, index])]",),
62
67
  }
63
68
  return args
64
69
 
65
70
  def __new__(
66
- cls, v_model: str | None = None, required: bool = False, type: str = "text", **kwargs: Any
71
+ cls,
72
+ v_model: Optional[Union[tuple[str, Any], str]] = None,
73
+ required: bool = False,
74
+ type: str = "text",
75
+ **kwargs: Any,
67
76
  ) -> AbstractElement:
68
77
  """Constructor for InputField.
69
78
 
70
79
  Parameters
71
80
  ----------
81
+ v_model : tuple[str, Any] or str, optional
82
+ The v-model for this component. If this references a Pydantic configuration variable, then this component
83
+ will attempt to load a label, hint, and validation rules from the configuration for you automatically.
72
84
  required : bool
73
85
  If true, the input will be visually marked as required and a required rule will be added to the end of the
74
86
  rules list.
@@ -90,6 +102,16 @@ class InputField:
90
102
  - textarea
91
103
 
92
104
  Any other value will produce a text field with your type used as an HTML input type attribute.
105
+ **kwargs
106
+ All other arguments will be passed to the underlying
107
+ `Trame Vuetify component <https://trame.readthedocs.io/en/latest/trame.widgets.vuetify3.html>`_.
108
+ The following example would set the auto_grow and label attributes on
109
+ `VTextarea <https://trame.readthedocs.io/en/latest/trame.widgets.vuetify3.html#trame.widgets.vuetify3.VTextarea>`_:
110
+
111
+ .. literalinclude:: ../tests/gallery/app.py
112
+ :start-after: InputField kwargs example start
113
+ :end-before: InputField kwargs example end
114
+ :dedent:
93
115
 
94
116
  Returns
95
117
  -------
@@ -3,12 +3,12 @@
3
3
  from functools import partial
4
4
  from typing import Any, Optional, cast
5
5
 
6
- from mvvm_lib.trame_binding import TrameBinding
7
6
  from trame.app import get_server
8
7
  from trame.widgets import client, html
9
8
  from trame.widgets import vuetify3 as vuetify
10
9
  from trame_client.widgets.core import AbstractElement
11
10
 
11
+ from nova.mvvm.trame_binding import TrameBinding
12
12
  from nova.trame.model.remote_file_input import RemoteFileInputModel
13
13
  from nova.trame.view.components import InputField
14
14
  from nova.trame.view_model.remote_file_input import RemoteFileInputViewModel
@@ -7,7 +7,7 @@ from trame_client.widgets.core import AbstractElement
7
7
 
8
8
 
9
9
  class GridLayout(html.Div):
10
- """Creates a grid with a specified number of rows and columns."""
10
+ """Creates a grid with a specified number of columns."""
11
11
 
12
12
  def __init__(
13
13
  self,
@@ -9,7 +9,6 @@ from typing import Optional
9
9
 
10
10
  import sass
11
11
  from mergedeep import Strategy, merge
12
- from mvvm_lib.pydantic_utils import validate_pydantic_parameter
13
12
  from trame.app import get_server
14
13
  from trame.assets.local import LocalFileManager
15
14
  from trame.ui.vuetify3 import VAppLayout
@@ -19,6 +18,7 @@ from trame_client.widgets import html
19
18
  from trame_server.core import Server
20
19
  from trame_server.state import State
21
20
 
21
+ from nova.mvvm.pydantic_utils import validate_pydantic_parameter
22
22
  from nova.trame.view.utilities.local_storage import LocalStorageManager
23
23
 
24
24
  THEME_PATH = Path(__file__).parent
@@ -2,8 +2,7 @@
2
2
 
3
3
  from typing import Any, Union
4
4
 
5
- from mvvm_lib.interface import BindingInterface
6
-
5
+ from nova.mvvm.interface import BindingInterface
7
6
  from nova.trame.model.remote_file_input import RemoteFileInputModel
8
7
 
9
8
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nova-trame
3
- Version: 0.9.0
3
+ Version: 0.10.1
4
4
  Summary: A Python Package for injecting curated themes and custom components into Trame applications
5
5
  License: MIT
6
6
  Keywords: NDIP,Python,Trame,Vuetify
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
16
  Requires-Dist: libsass (>=0.23.0,<0.24.0)
17
17
  Requires-Dist: mergedeep (>=1.3.4,<2.0.0)
18
- Requires-Dist: mvvm-lib (>=0.5.0)
18
+ Requires-Dist: nova-mvvm (>=0.6.1,<0.7.0)
19
19
  Requires-Dist: pydantic (>=2.10.1,<3.0.0)
20
20
  Requires-Dist: tomli (>=2.0.2,<3.0.0)
21
21
  Requires-Dist: trame (>=3.6.3,<4.0.0)
@@ -1,24 +1,24 @@
1
- nova/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1
+ nova/__init__.py,sha256=ED6jHcYiuYpr_0vjGz0zx2lrrmJT9sDJCzIljoDfmlM,65
2
2
  nova/trame/__init__.py,sha256=gFrAg1qva5PIqR5TjvPzAxLx103IKipJLqp3XXvrQL8,59
3
3
  nova/trame/model/remote_file_input.py,sha256=GRvWepYcFPjyrMOCI-mgr8GvDSYNag2oGqG-QY1Jfbw,3280
4
4
  nova/trame/view/components/__init__.py,sha256=fopr6mVqcpDcVYK9ue7SLUHyswgvRPcFESTq86mu1R8,128
5
- nova/trame/view/components/input_field.py,sha256=yY7rYIUWCdfhG5edn7gFusPnmc2M1mUg2rnbvWBbuyY,11147
6
- nova/trame/view/components/remote_file_input.py,sha256=SNy-SMiO_N9zwW6Lfo_WvpAt_jWANNh-9P5xd75AhtI,8232
5
+ nova/trame/view/components/input_field.py,sha256=CvVbuMuSu-vgRgyZsooscGw2nbxBbyangvrx2GmzuS8,12243
6
+ nova/trame/view/components/remote_file_input.py,sha256=FaS1TxFBdNp8xB6CicC5iAX4kSdwePwRCiyTas0d_Tc,8233
7
7
  nova/trame/view/components/visualization/__init__.py,sha256=kDX1fkbtAgXSGlqhlMNhYYoYrq-hfS636smjgLsh6gg,84
8
8
  nova/trame/view/components/visualization/interactive_2d_plot.py,sha256=foZCMoqbuahT5dtqIQvm8C4ZJcY9P211eJEcpQJltmM,3421
9
9
  nova/trame/view/layouts/__init__.py,sha256=cMrlB5YMUoK8EGB83b34UU0kPTVrH8AxsYvKRtpUNEc,141
10
- nova/trame/view/layouts/grid.py,sha256=s4w9py-VVTDVdohLvoVmWoCFb29GuTeLQRPUIoZbjQg,5030
10
+ nova/trame/view/layouts/grid.py,sha256=k-QHuH31XeAVDuMKUMoAMVnAM-Yavq7kdLYOC1ZrGTQ,5021
11
11
  nova/trame/view/layouts/hbox.py,sha256=r5irhFX6YWTWN4V4NwNQx6mheyM8p6PVcJbrbhvOAwo,2625
12
12
  nova/trame/view/layouts/vbox.py,sha256=Q4EvrtGJORyNF6AnCLGXToy8XU6yofiO5_kt7hK-AYs,2626
13
13
  nova/trame/view/theme/__init__.py,sha256=70_marDlTigIcPEOGiJb2JTs-8b2sGM5SlY7XBPtBDM,54
14
14
  nova/trame/view/theme/assets/core_style.scss,sha256=AktysiiCYLeiTzCTtYwkksiUVmqb4S23RlDcW8L1ebI,518
15
15
  nova/trame/view/theme/assets/favicon.png,sha256=Xbp1nUmhcBDeObjsebEbEAraPDZ_M163M_ZLtm5AbQc,1927
16
16
  nova/trame/view/theme/assets/vuetify_config.json,sha256=1EwlDUHZiM45MWgnHSQKgLH_d0IZ1iaXjl3eXxGc2EI,4832
17
- nova/trame/view/theme/theme.py,sha256=k2dmhZ21Q5QSnCTFvegHTd0qsWPjn2OvBerxyX5eJVE,11401
17
+ nova/trame/view/theme/theme.py,sha256=lHeXZPGiS1Ezn3aiKpoEyarLgxOyatWOzYSApX9VI3M,11402
18
18
  nova/trame/view/utilities/local_storage.py,sha256=vD8f2VZIpxhIKjZwEaD7siiPCTZO4cw9AfhwdawwYLY,3218
19
- nova/trame/view_model/remote_file_input.py,sha256=tXBw9M1ZKXwm-deHdoRB9uz8CEX9ym7qGtlZUpcZeFw,2986
20
- nova_trame-0.9.0.dist-info/LICENSE,sha256=MOqZ8tPMKy8ZETJ2-HEvFTZ7dYNlg3gXmBkV-Y9i8bw,1061
21
- nova_trame-0.9.0.dist-info/METADATA,sha256=3MzeLpEzhpdiE1EFM43aRyKn1F8FgMSq43PSDizgFCU,1370
22
- nova_trame-0.9.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
23
- nova_trame-0.9.0.dist-info/entry_points.txt,sha256=J2AmeSwiTYZ4ZqHHp9HO6v4MaYQTTBPbNh6WtoqOT58,42
24
- nova_trame-0.9.0.dist-info/RECORD,,
19
+ nova/trame/view_model/remote_file_input.py,sha256=EU8jrU_3_BQqvta5-owSotHG0LAxLbTp6INqk3TdIZc,2986
20
+ nova_trame-0.10.1.dist-info/LICENSE,sha256=MOqZ8tPMKy8ZETJ2-HEvFTZ7dYNlg3gXmBkV-Y9i8bw,1061
21
+ nova_trame-0.10.1.dist-info/METADATA,sha256=N33T_oJm7cVw4WHRmoglB12W6rizrcDEJnwmjL1MjxQ,1379
22
+ nova_trame-0.10.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
23
+ nova_trame-0.10.1.dist-info/entry_points.txt,sha256=J2AmeSwiTYZ4ZqHHp9HO6v4MaYQTTBPbNh6WtoqOT58,42
24
+ nova_trame-0.10.1.dist-info/RECORD,,