reflex 0.4.7a2__py3-none-any.whl → 0.4.7a3__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.
- reflex/custom_components/custom_components.py +28 -34
- reflex/utils/types.py +3 -2
- {reflex-0.4.7a2.dist-info → reflex-0.4.7a3.dist-info}/METADATA +1 -1
- {reflex-0.4.7a2.dist-info → reflex-0.4.7a3.dist-info}/RECORD +7 -7
- {reflex-0.4.7a2.dist-info → reflex-0.4.7a3.dist-info}/LICENSE +0 -0
- {reflex-0.4.7a2.dist-info → reflex-0.4.7a3.dist-info}/WHEEL +0 -0
- {reflex-0.4.7a2.dist-info → reflex-0.4.7a3.dist-info}/entry_points.txt +0 -0
|
@@ -71,6 +71,28 @@ def _create_package_config(module_name: str, package_name: str):
|
|
|
71
71
|
)
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
def _get_package_config(exit_on_fail: bool = True) -> dict:
|
|
75
|
+
"""Get the package configuration from the pyproject.toml file.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
exit_on_fail: Whether to exit if the pyproject.toml file is not found.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
The package configuration.
|
|
82
|
+
|
|
83
|
+
Raises:
|
|
84
|
+
Exit: If the pyproject.toml file is not found.
|
|
85
|
+
"""
|
|
86
|
+
try:
|
|
87
|
+
with open(CustomComponents.PYPROJECT_TOML, "rb") as f:
|
|
88
|
+
return dict(tomlkit.load(f))
|
|
89
|
+
except (OSError, TOMLKitError) as ex:
|
|
90
|
+
console.error(f"Unable to read from pyproject.toml due to {ex}")
|
|
91
|
+
if exit_on_fail:
|
|
92
|
+
raise typer.Exit(code=1) from ex
|
|
93
|
+
raise
|
|
94
|
+
|
|
95
|
+
|
|
74
96
|
def _create_readme(module_name: str, package_name: str):
|
|
75
97
|
"""Create a package README file.
|
|
76
98
|
|
|
@@ -416,9 +438,7 @@ def _run_commands_in_subprocess(cmds: list[str]) -> bool:
|
|
|
416
438
|
|
|
417
439
|
def _make_pyi_files():
|
|
418
440
|
"""Create pyi files for the custom component."""
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
package_name = glob("custom_components/*.egg-info")[0].replace(".egg-info", "")
|
|
441
|
+
package_name = _get_package_config()["project"]["name"]
|
|
422
442
|
|
|
423
443
|
for dir, _, _ in os.walk(f"./{package_name}"):
|
|
424
444
|
if "__pycache__" in dir:
|
|
@@ -514,22 +534,10 @@ def _validate_credentials(
|
|
|
514
534
|
def _get_version_to_publish() -> str:
|
|
515
535
|
"""Get the version to publish from the pyproject.toml.
|
|
516
536
|
|
|
517
|
-
Raises:
|
|
518
|
-
Exit: If the version is not found in the pyproject.toml.
|
|
519
|
-
|
|
520
537
|
Returns:
|
|
521
538
|
The version to publish.
|
|
522
539
|
"""
|
|
523
|
-
|
|
524
|
-
try:
|
|
525
|
-
with open(CustomComponents.PYPROJECT_TOML, "rb") as f:
|
|
526
|
-
project_toml = tomlkit.parse(f.read())
|
|
527
|
-
return project_toml.get("project", {})["version"]
|
|
528
|
-
except (OSError, KeyError, TOMLKitError) as ex:
|
|
529
|
-
console.error(
|
|
530
|
-
f"Cannot find the version in {CustomComponents.PYPROJECT_TOML} due to {ex}"
|
|
531
|
-
)
|
|
532
|
-
raise typer.Exit(code=1) from ex
|
|
540
|
+
return _get_package_config()["project"]["version"]
|
|
533
541
|
|
|
534
542
|
|
|
535
543
|
def _ensure_dist_dir(version_to_publish: str, build: bool):
|
|
@@ -733,12 +741,7 @@ def _validate_project_info():
|
|
|
733
741
|
Raises:
|
|
734
742
|
Exit: If the pyproject.toml file is ill-formed.
|
|
735
743
|
"""
|
|
736
|
-
|
|
737
|
-
with open(CustomComponents.PYPROJECT_TOML, "rb") as f:
|
|
738
|
-
pyproject_toml = tomlkit.parse(f.read())
|
|
739
|
-
except TOMLKitError as ex:
|
|
740
|
-
console.error(f"Unable to read from pyproject.toml due to {ex}")
|
|
741
|
-
raise typer.Exit(code=1) from ex
|
|
744
|
+
pyproject_toml = _get_package_config()
|
|
742
745
|
|
|
743
746
|
try:
|
|
744
747
|
project = pyproject_toml.get("project", {})
|
|
@@ -796,7 +799,7 @@ def _validate_project_info():
|
|
|
796
799
|
with open(CustomComponents.PYPROJECT_TOML, "w") as f:
|
|
797
800
|
tomlkit.dump(pyproject_toml, f)
|
|
798
801
|
except (OSError, TOMLKitError) as ex:
|
|
799
|
-
console.error(f"Unable to
|
|
802
|
+
console.error(f"Unable to write to pyproject.toml due to {ex}")
|
|
800
803
|
raise typer.Exit(code=1) from ex
|
|
801
804
|
|
|
802
805
|
|
|
@@ -816,10 +819,8 @@ def _collect_details_for_gallery():
|
|
|
816
819
|
params = {}
|
|
817
820
|
package_name = None
|
|
818
821
|
try:
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
package_name = project_toml.get("project", {})["name"]
|
|
822
|
-
except (OSError, TOMLKitError, KeyError) as ex:
|
|
822
|
+
package_name = _get_package_config(exit_on_fail=False)["project"]["name"]
|
|
823
|
+
except (TOMLKitError, KeyError) as ex:
|
|
823
824
|
console.debug(
|
|
824
825
|
f"Unable to read from pyproject.toml in current directory due to {ex}"
|
|
825
826
|
)
|
|
@@ -850,13 +851,6 @@ def _collect_details_for_gallery():
|
|
|
850
851
|
console.error(f"Unable to complete request due to {he}.")
|
|
851
852
|
raise typer.Exit(code=1) from he
|
|
852
853
|
|
|
853
|
-
display_name = (
|
|
854
|
-
console.ask("[ Friendly display name for your component ] (enter to skip)")
|
|
855
|
-
or None
|
|
856
|
-
)
|
|
857
|
-
if display_name:
|
|
858
|
-
params["display_name"] = display_name
|
|
859
|
-
|
|
860
854
|
files = []
|
|
861
855
|
if (image_file_and_extension := _get_file_from_prompt_in_loop()) is not None:
|
|
862
856
|
files.append(
|
reflex/utils/types.py
CHANGED
|
@@ -416,11 +416,12 @@ def validate_literal(key: str, value: Any, expected_type: Type, comp_name: str):
|
|
|
416
416
|
):
|
|
417
417
|
allowed_values = expected_type.__args__
|
|
418
418
|
if value not in allowed_values:
|
|
419
|
-
|
|
419
|
+
allowed_value_str = ",".join(
|
|
420
420
|
[str(v) if not isinstance(v, str) else f"'{v}'" for v in allowed_values]
|
|
421
421
|
)
|
|
422
|
+
value_str = f"'{value}'" if isinstance(value, str) else value
|
|
422
423
|
raise ValueError(
|
|
423
|
-
f"prop value for {str(key)} of the `{comp_name}` component should be one of the following: {
|
|
424
|
+
f"prop value for {str(key)} of the `{comp_name}` component should be one of the following: {allowed_value_str}. Got {value_str} instead"
|
|
424
425
|
)
|
|
425
426
|
|
|
426
427
|
|
|
@@ -470,7 +470,7 @@ reflex/constants/installer.py,sha256=wzoO_TaXF6N54CKmqpSSzT9QGIPalYn245AtUIIlEY0
|
|
|
470
470
|
reflex/constants/route.py,sha256=9ydQEdlz3YwGmGMHVGz7zA-INoOLtz_xUU2S-WmhZZM,1940
|
|
471
471
|
reflex/constants/style.py,sha256=gSzu0sQEQjW81PekxJnwRs7SXQQVco-LxtVjCi0IQZc,636
|
|
472
472
|
reflex/custom_components/__init__.py,sha256=R4zsvOi4dfPmHc18KEphohXnQFBPnUCb50cMR5hSLDE,36
|
|
473
|
-
reflex/custom_components/custom_components.py,sha256=
|
|
473
|
+
reflex/custom_components/custom_components.py,sha256=Q2Ef3QvO3fheL-rcUF8g92xmY54UtJAHs7t_Dq1P65A,31705
|
|
474
474
|
reflex/event.py,sha256=tQH1fLdBrTRI150VxiK6SbUBByPQxMNDylaSBYVliYM,26634
|
|
475
475
|
reflex/experimental/__init__.py,sha256=nx9HxdZfYmCjR6LWbB6ms1Y_saZQWVQBUNSQAFs_F6s,287
|
|
476
476
|
reflex/experimental/hooks.py,sha256=8LWdoq1aQPCA3ySDtlUzsPGiizM8CINvHUU6-ukZIFs,1647
|
|
@@ -498,12 +498,12 @@ reflex/utils/processes.py,sha256=SaDkqJVyhdyp5gE3Rn8MbU1VMNGN3BTObK5WWwqoEAE,848
|
|
|
498
498
|
reflex/utils/pyi_generator.py,sha256=VyGG0Tj3nvyBi2OQU-oscWRhJyRiYG9rUvJolKLK5Gg,27674
|
|
499
499
|
reflex/utils/serializers.py,sha256=4LOCpri11NKVocnPb4zzgIBvW8fT-fX0h_1DIMfv5yI,8538
|
|
500
500
|
reflex/utils/telemetry.py,sha256=NYAzPe7nU0EUwq2hIAByOzlie_5RhFlfHganBqG5OfA,4013
|
|
501
|
-
reflex/utils/types.py,sha256
|
|
501
|
+
reflex/utils/types.py,sha256=IUU7Gb6A_b-m1GbLb-fFhCp89YGddDgfCjSttF9od2c,13677
|
|
502
502
|
reflex/utils/watch.py,sha256=HzGrHQIZ_62Di0BO46kd2AZktNA3A6nFIBuf8c6ip30,2609
|
|
503
503
|
reflex/vars.py,sha256=mef13GC4G_Iqicliyp6k9EWGULC1p1UewgM7gJODcBw,67152
|
|
504
504
|
reflex/vars.pyi,sha256=7sVCLoLg9Y7QAmXWz6FCtVmScpSV84u0yQ3ZBImb_Bk,5583
|
|
505
|
-
reflex-0.4.
|
|
506
|
-
reflex-0.4.
|
|
507
|
-
reflex-0.4.
|
|
508
|
-
reflex-0.4.
|
|
509
|
-
reflex-0.4.
|
|
505
|
+
reflex-0.4.7a3.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
|
|
506
|
+
reflex-0.4.7a3.dist-info/METADATA,sha256=xc8x1xNoBsrBroC1urtThDuxHm4guV0fxuqJ-GSnB8E,11815
|
|
507
|
+
reflex-0.4.7a3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
508
|
+
reflex-0.4.7a3.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
|
|
509
|
+
reflex-0.4.7a3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|