reflex 0.4.6__py3-none-any.whl → 0.4.6a2__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.

Potentially problematic release.


This version of reflex might be problematic. Click here for more details.

@@ -1029,6 +1029,16 @@ class Component(BaseComponent, ABC):
1029
1029
  )
1030
1030
  return _imports
1031
1031
 
1032
+ def add_imports(
1033
+ self,
1034
+ ) -> Dict[str, Union[str, ImportVar, List[str | ImportVar]]]:
1035
+ """User defined imports for the component. Need to be overriden in subclass.
1036
+
1037
+ Returns:
1038
+ The user defined imports as a dict.
1039
+ """
1040
+ return {}
1041
+
1032
1042
  def _get_imports(self) -> imports.ImportDict:
1033
1043
  """Get all the libraries and fields that are used by the component.
1034
1044
 
@@ -1049,12 +1059,29 @@ class Component(BaseComponent, ABC):
1049
1059
  var._var_data.imports for var in self._get_vars() if var._var_data
1050
1060
  ]
1051
1061
 
1062
+ # If the subclass implements add_imports, merge the imports.
1063
+ def _make_list(
1064
+ value: str | ImportVar | list[str | ImportVar],
1065
+ ) -> list[str | ImportVar]:
1066
+ if isinstance(value, (str, ImportVar)):
1067
+ return [value]
1068
+ return value
1069
+
1070
+ added_imports = {
1071
+ package: [
1072
+ ImportVar(tag=tag) if not isinstance(tag, ImportVar) else tag
1073
+ for tag in _make_list(maybe_tags)
1074
+ ]
1075
+ for package, maybe_tags in self.add_imports().items()
1076
+ }
1077
+
1052
1078
  return imports.merge_imports(
1053
1079
  *self._get_props_imports(),
1054
1080
  self._get_dependencies_imports(),
1055
1081
  self._get_hooks_imports(),
1056
1082
  _imports,
1057
1083
  event_imports,
1084
+ added_imports,
1058
1085
  *var_imports,
1059
1086
  )
1060
1087
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: reflex
3
- Version: 0.4.6
3
+ Version: 0.4.6a2
4
4
  Summary: Web apps in pure Python.
5
5
  Home-page: https://reflex.dev
6
6
  License: Apache-2.0
@@ -39,7 +39,7 @@ Requires-Dist: sqlmodel (>=0.0.14,<0.1)
39
39
  Requires-Dist: starlette-admin (>=0.11.0,<1.0)
40
40
  Requires-Dist: tomlkit (>=0.12.4,<1.0)
41
41
  Requires-Dist: twine (>=4.0.0,<6.0)
42
- Requires-Dist: typer (>=0.4.2,<1.0)
42
+ Requires-Dist: typer (>=0.4.2,<0.12.0)
43
43
  Requires-Dist: uvicorn (>=0.20.0,<0.21.0) ; python_version < "3.12"
44
44
  Requires-Dist: uvicorn (>=0.24.0,<0.25.0) ; python_version >= "3.12"
45
45
  Requires-Dist: watchdog (>=2.3.1,<5.0)
@@ -250,7 +250,7 @@ reflex/components/chakra/typography/span.py,sha256=2DbW5DB27ijtTeugSDUVp3nQ64mrG
250
250
  reflex/components/chakra/typography/span.pyi,sha256=fOYu3o8OaSDwaWiu-7CrEm8w9azlxHhiZcKqcFxRe6o,3443
251
251
  reflex/components/chakra/typography/text.py,sha256=9YXBdK5UYqgDam3ITeRSnd8bu9ht3zydt0pkmJAECsk,472
252
252
  reflex/components/chakra/typography/text.pyi,sha256=QwD1kqrIpXwu-RaZpnoGbsMHb4D3t9CfHjgbS7ds9G8,3667
253
- reflex/components/component.py,sha256=ONuFARlONsXPRii8FadIkwUZtn0XzRx1MuLxhO4zz14,65276
253
+ reflex/components/component.py,sha256=ZMVHpkh6ajAqpX5OCtKtQgy3M_Y8AiXn4h3DslLCbCE,66152
254
254
  reflex/components/core/__init__.py,sha256=mMSd2IZqBgGf7zkjuPeA-oIiIXu_O08fk9x15D8hBSU,844
255
255
  reflex/components/core/banner.py,sha256=kc9vSySgXzFxB_XaeWlw51UC4LaujrSjRSmgQI4z0yI,5937
256
256
  reflex/components/core/banner.pyi,sha256=PPS1GJLp5uyD1h6mI0Fs-IKf9w4l7qG50rmkSA_HVno,17164
@@ -516,8 +516,8 @@ reflex/utils/types.py,sha256=-OT6RLGOfKnzlArNua7Kld6DLFeUFAasHS5B2RjLqsE,13585
516
516
  reflex/utils/watch.py,sha256=HzGrHQIZ_62Di0BO46kd2AZktNA3A6nFIBuf8c6ip30,2609
517
517
  reflex/vars.py,sha256=LNQkoL58s5Ea4nB8H8N6ZUe24xzuC_4lNpqnDUi50p8,67145
518
518
  reflex/vars.pyi,sha256=4sZo25A0nZ5nLhZ_uUnnz8enzBddhBvGmuHZAM2JhU4,5575
519
- reflex-0.4.6.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
520
- reflex-0.4.6.dist-info/METADATA,sha256=Y9_Q4XCBdQzZ_g6pt2U-60onFlSjiPk5HsTnL7SWzhg,11365
521
- reflex-0.4.6.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
522
- reflex-0.4.6.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
523
- reflex-0.4.6.dist-info/RECORD,,
519
+ reflex-0.4.6a2.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
520
+ reflex-0.4.6a2.dist-info/METADATA,sha256=ykHuuwgbmvuPztaNvWN5IkN7hmLNSdL0npexB3NAEhg,11370
521
+ reflex-0.4.6a2.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
522
+ reflex-0.4.6a2.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
523
+ reflex-0.4.6a2.dist-info/RECORD,,