[REF-3568][REF-3569]Remove deprecations (#3852)

* Remove deprecations

* remove prop conversion

* fix tests

* fix slight issue

* fix darglint
This commit is contained in:
Elijah Ahianyo 2024-08-29 22:46:18 +00:00 committed by GitHub
parent 4d9f427b19
commit e6080a7707
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 7 additions and 535 deletions

View File

@ -45,7 +45,7 @@ from reflex.event import (
)
from reflex.ivars.base import ImmutableVar, LiteralVar
from reflex.style import Style, format_as_emotion
from reflex.utils import console, format, imports, types
from reflex.utils import format, imports, types
from reflex.utils.imports import ImportDict, ImportVar, ParsedImportDict, parse_imports
from reflex.utils.serializers import serializer
from reflex.vars import BaseVar, ImmutableVarData, Var, VarData
@ -636,27 +636,6 @@ class Component(BaseComponent, ABC):
return _compile_component(self)
def _apply_theme(self, theme: Optional[Component]):
"""Apply the theme to this component.
Deprecated. Use add_style instead.
Args:
theme: The theme to apply.
"""
pass
def apply_theme(self, theme: Optional[Component]):
"""Apply a theme to the component and its children.
Args:
theme: The theme to apply.
"""
self._apply_theme(theme)
for child in self.children:
if isinstance(child, Component):
child.apply_theme(theme)
def _exclude_props(self) -> list[str]:
"""Props to exclude when adding the component props to the Tag.
@ -764,22 +743,6 @@ class Component(BaseComponent, ABC):
from reflex.components.base.fragment import Fragment
from reflex.utils.exceptions import ComponentTypeError
# Translate deprecated props to new names.
new_prop_names = [
prop for prop in cls.get_props() if prop in ["type", "min", "max"]
]
for prop in new_prop_names:
under_prop = f"{prop}_"
if under_prop in props:
console.deprecate(
f"Underscore suffix for prop `{under_prop}`",
reason=f"for consistency. Use `{prop}` instead.",
deprecation_version="0.4.0",
removal_version="0.6.0",
dedupe=False,
)
props[prop] = props.pop(under_prop)
# Filter out None props
props = {key: value for key, value in props.items() if value is not None}
@ -896,17 +859,6 @@ class Component(BaseComponent, ABC):
new_style.update(component_style)
style_vars.append(component_style._var_data)
# 3. User-defined style from `Component.style`.
# Apply theme for retro-compatibility with deprecated _apply_theme API
if type(self)._apply_theme != Component._apply_theme:
console.deprecate(
f"{self.__class__.__name__}._apply_theme",
reason="use add_style instead",
deprecation_version="0.5.0",
removal_version="0.6.0",
)
self._apply_theme(theme)
# 4. style dict and css props passed to the component instance.
new_style.update(self.style)
style_vars.append(self.style._var_data)

View File

@ -11,7 +11,6 @@ from reflex.components.tags import IterTag
from reflex.constants import MemoizationMode
from reflex.ivars.base import ImmutableVar
from reflex.state import ComponentState
from reflex.utils import console
from reflex.vars import Var
@ -39,14 +38,12 @@ class Foreach(Component):
cls,
iterable: Var[Iterable] | Iterable,
render_fn: Callable,
**props,
) -> Foreach:
"""Create a foreach component.
Args:
iterable: The iterable to create components from.
render_fn: A function from the render args to the component.
**props: The attributes to pass to each child component (deprecated).
Returns:
The foreach component.
@ -55,13 +52,6 @@ class Foreach(Component):
ForeachVarError: If the iterable is of type Any.
TypeError: If the render function is a ComponentState.
"""
if props:
console.deprecate(
feature_name="Passing props to rx.foreach",
reason="it does not have the intended effect and may be confusing",
deprecation_version="0.5.0",
removal_version="0.6.0",
)
iterable = ImmutableVar.create_safe(iterable)
if iterable._var_type == Any:
raise ForeachVarError(

View File

@ -10,7 +10,6 @@ _SUBMODULES: set[str] = {"elements"}
_SUBMOD_ATTRS: dict[str, list[str]] = {
f"elements.{k}": v for k, v in elements._MAPPING.items()
}
_PYRIGHT_IGNORE_IMPORTS = elements._PYRIGHT_IGNORE_IMPORTS
__getattr__, __dir__, __all__ = lazy_loader.attach(
__name__,

View File

@ -3,7 +3,6 @@
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------
from . import elements
from .elements.forms import Button as Button
from .elements.forms import Fieldset as Fieldset
from .elements.forms import Form as Form
@ -88,36 +87,28 @@ from .elements.inline import u as u
from .elements.inline import wbr as wbr
from .elements.media import Area as Area
from .elements.media import Audio as Audio
from .elements.media import Defs as Defs
from .elements.media import Embed as Embed
from .elements.media import Iframe as Iframe
from .elements.media import Img as Img
from .elements.media import LinearGradient as LinearGradient
from .elements.media import Map as Map
from .elements.media import Object as Object
from .elements.media import Path as Path
from .elements.media import Picture as Picture
from .elements.media import Portal as Portal
from .elements.media import Source as Source
from .elements.media import Stop as Stop
from .elements.media import Svg as Svg
from .elements.media import Track as Track
from .elements.media import Video as Video
from .elements.media import area as area
from .elements.media import audio as audio
from .elements.media import defs as defs # type: ignore
from .elements.media import embed as embed
from .elements.media import iframe as iframe
from .elements.media import image as image
from .elements.media import img as img
from .elements.media import lineargradient as lineargradient # type: ignore
from .elements.media import map as map
from .elements.media import object as object
from .elements.media import path as path # type: ignore
from .elements.media import picture as picture
from .elements.media import portal as portal
from .elements.media import source as source
from .elements.media import stop as stop # type: ignore
from .elements.media import svg as svg
from .elements.media import track as track
from .elements.media import video as video
@ -231,5 +222,3 @@ from .elements.typography import ol as ol
from .elements.typography import p as p
from .elements.typography import pre as pre
from .elements.typography import ul as ul
_PYRIGHT_IGNORE_IMPORTS = elements._PYRIGHT_IGNORE_IMPORTS

View File

@ -65,11 +65,6 @@ _MAPPING = {
"portal",
"source",
"svg",
"defs",
"lineargradient",
"LinearGradient",
"stop",
"path",
],
"metadata": [
"base",
@ -130,13 +125,12 @@ _MAPPING = {
}
EXCLUDE = ["del_", "Del", "image", "lineargradient", "LinearGradient"]
EXCLUDE = ["del_", "Del", "image"]
for _, v in _MAPPING.items():
v.extend([mod.capitalize() for mod in v if mod not in EXCLUDE])
_SUBMOD_ATTRS: dict[str, list[str]] = _MAPPING
_PYRIGHT_IGNORE_IMPORTS = ["stop", "lineargradient", "path", "defs"]
__getattr__, __dir__, __all__ = lazy_loader.attach(
__name__,
submod_attrs=_SUBMOD_ATTRS,

View File

@ -87,36 +87,28 @@ from .inline import u as u
from .inline import wbr as wbr
from .media import Area as Area
from .media import Audio as Audio
from .media import Defs as Defs
from .media import Embed as Embed
from .media import Iframe as Iframe
from .media import Img as Img
from .media import LinearGradient as LinearGradient
from .media import Map as Map
from .media import Object as Object
from .media import Path as Path
from .media import Picture as Picture
from .media import Portal as Portal
from .media import Source as Source
from .media import Stop as Stop
from .media import Svg as Svg
from .media import Track as Track
from .media import Video as Video
from .media import area as area
from .media import audio as audio
from .media import defs as defs # type: ignore
from .media import embed as embed
from .media import iframe as iframe
from .media import image as image
from .media import img as img
from .media import lineargradient as lineargradient # type: ignore
from .media import map as map
from .media import object as object
from .media import path as path # type: ignore
from .media import picture as picture
from .media import portal as portal
from .media import source as source
from .media import stop as stop # type: ignore
from .media import svg as svg
from .media import track as track
from .media import video as video
@ -292,11 +284,6 @@ _MAPPING = {
"portal",
"source",
"svg",
"defs",
"lineargradient",
"LinearGradient",
"stop",
"path",
],
"metadata": ["base", "head", "link", "meta", "title", "style"],
"other": ["details", "dialog", "summary", "slot", "template", "math", "html"],
@ -348,7 +335,6 @@ _MAPPING = {
"Del",
],
}
EXCLUDE = ["del_", "Del", "image", "lineargradient", "LinearGradient"]
EXCLUDE = ["del_", "Del", "image"]
for _, v in _MAPPING.items():
v.extend([mod.capitalize() for mod in v if mod not in EXCLUDE])
_PYRIGHT_IGNORE_IMPORTS = ["stop", "lineargradient", "path", "defs"]

View File

@ -4,7 +4,6 @@ from typing import Any, Union
from reflex import Component, ComponentNamespace
from reflex.constants.colors import Color
from reflex.utils import console
from reflex.vars import Var as Var
from .base import BaseHTML
@ -445,23 +444,3 @@ picture = Picture.create
portal = Portal.create
source = Source.create
svg = SVG()
def __getattr__(name: str):
if name in ("defs", "lineargradient", "stop", "path"):
console.deprecate(
f"`rx.el.{name}`",
reason=f"use `rx.el.svg.{'linear_gradient' if name =='lineargradient' else name}`",
deprecation_version="0.5.8",
removal_version="0.6.0",
)
return (
LinearGradient.create
if name == "lineargradient"
else globals()[name.capitalize()].create
)
try:
return globals()[name]
except KeyError:
raise AttributeError(f"module '{__name__} has no attribute '{name}'") from None

View File

@ -1,7 +1,7 @@
"""Lucide Icon component."""
from reflex.components.component import Component
from reflex.utils import console, format
from reflex.utils import format
from reflex.vars import Var
@ -36,19 +36,6 @@ class Icon(LucideIconComponent):
Returns:
The created component.
"""
def map_deprecated_icon_names_05(tag: str) -> str:
new_tag = RENAMED_ICONS_05.get(tag)
if new_tag is not None:
console.deprecate(
feature_name=f"icon {tag}",
reason=f"it was renamed upstream. Use {new_tag} instead.",
deprecation_version="0.4.6",
removal_version="0.6.0",
)
return new_tag
return tag
if children:
if len(children) == 1 and isinstance(children[0], str):
props["tag"] = children[0]
@ -62,8 +49,7 @@ class Icon(LucideIconComponent):
if (
not isinstance(props["tag"], str)
or map_deprecated_icon_names_05(format.to_snake_case(props["tag"]))
not in LUCIDE_ICON_LIST
or format.to_snake_case(props["tag"]) not in LUCIDE_ICON_LIST
):
raise ValueError(
f"Invalid icon tag: {props['tag']}. Please use one of the following: {', '.join(LUCIDE_ICON_LIST[0:25])}, ..."
@ -76,116 +62,6 @@ class Icon(LucideIconComponent):
return super().create(*children, **props)
RENAMED_ICONS_05 = {
"activity_square": "square_activity",
"alert_circle": "circle_alert",
"alert_octagon": "octagon_alert",
"alert_triangle": "triangle_alert",
"arrow_down_circle": "circle_arrow_down",
"arrow_down_left_from_circle": "circle_arrow_out_down_left",
"arrow_down_left_from_square": "square_arrow_out_down_left",
"arrow_down_left_square": "square_arrow_down_left",
"arrow_down_right_from_circle": "circle_arrow_out_down_right",
"arrow_down_right_from_square": "square_arrow_out_down_right",
"arrow_down_right_square": "square_arrow_down_right",
"arrow_down_square": "square_arrow_down",
"arrow_left_circle": "circle_arrow_left",
"arrow_left_square": "square_arrow_left",
"arrow_right_circle": "circle_arrow_right",
"arrow_right_square": "square_arrow_right",
"arrow_up_circle": "circle_arrow_up",
"arrow_up_left_from_circle": "circle_arrow_out_up_left",
"arrow_up_left_from_square": "square_arrow_out_up_left",
"arrow_up_left_square": "square_arrow_up_left",
"arrow_up_right_from_circle": "circle_arrow_out_up_right",
"arrow_up_right_from_square": "square_arrow_out_up_right",
"arrow_up_right_square": "square_arrow_up_right",
"arrow_up_square": "square_arrow_up",
"asterisk_square": "square_asterisk",
"check_circle": "circle_check_big",
"check_circle_2": "circle_check",
"check_square": "square_check_big",
"check_square_2": "square_check",
"chevron_down_circle": "circle_chevron_down",
"chevron_down_square": "square_chevron_down",
"chevron_left_circle": "circle_chevron_left",
"chevron_left_square": "square_chevron_left",
"chevron_right_circle": "circle_chevron_right",
"chevron_right_square": "square_chevron_right",
"chevron_up_circle": "circle_chevron_up",
"chevron_up_square": "square_chevron_up",
"code_2": "code_xml",
"code_square": "square_code",
"contact_2": "contact_round",
"divide_circle": "circle_divide",
"divide_square": "square_divide",
"dot_square": "square_dot",
"download_cloud": "cloud_download",
"equal_square": "square_equal",
"form_input": "rectangle_ellipsis",
"function_square": "square_function",
"gantt_chart_square": "square_gantt_chart",
"gauge_circle": "circle_gauge",
"globe_2": "earth",
"help_circle": "circle_help",
"helping_hand": "hand_helping",
"ice_cream": "ice_cream_cone",
"ice_cream_2": "ice_cream_bowl",
"indent": "indent_increase",
"kanban_square": "square_kanban",
"kanban_square_dashed": "square_dashed_kanban",
"laptop_2": "laptop_minimal",
"library_square": "square_library",
"loader_2": "loader_circle",
"m_square": "square_m",
"menu_square": "square_menu",
"mic_2": "mic_vocal",
"minus_circle": "circle_minus",
"minus_square": "square_minus",
"more_horizontal": "ellipsis",
"more_vertical": "ellipsis_vertical",
"mouse_pointer_square": "square_mouse_pointer",
"mouse_pointer_square_dashed": "square_dashed_mouse_pointer",
"outdent": "indent_decrease",
"palm_tree": "tree_palm",
"parking_circle": "circle_parking",
"parking_circle_off": "circle_parking_off",
"parking_square": "square_parking",
"parking_square_off": "square_parking_off",
"pause_circle": "circle_pause",
"pause_octagon": "octagon_pause",
"percent_circle": "circle_percent",
"percent_diamond": "diamond_percent",
"percent_square": "square_percent",
"pi_square": "square_pi",
"pilcrow_square": "square_pilcrow",
"play_circle": "circle_play",
"play_square": "square_play",
"plus_circle": "circle_plus",
"plus_square": "square_plus",
"power_circle": "circle_power",
"power_square": "square_power",
"school_2": "university",
"scissors_square": "square_scissors",
"scissors_square_dashed_bottom": "square_bottom_dashed_scissors",
"sigma_square": "square_sigma",
"slash_circle": "circle_slash",
"sliders": "sliders_vertical",
"split_square_horizontal": "square_split_horizontal",
"split_square_vertical": "square_split_vertical",
"stop_circle": "circle_stop",
"subtitles": "captions",
"test_tube_2": "test_tube_diagonal",
"unlock": "lock_open",
"unlock_keyhole": "lock_keyhole_open",
"upload_cloud": "cloud_upload",
"wallet_2": "wallet_minimal",
"wand_2": "wand_sparkles",
"x_circle": "circle_x",
"x_octagon": "octagon_x",
"x_square": "square_x",
}
LUCIDE_ICON_LIST = [
"a_arrow_down",
"a_arrow_up",

View File

@ -150,115 +150,6 @@ class Icon(LucideIconComponent):
"""
...
RENAMED_ICONS_05 = {
"activity_square": "square_activity",
"alert_circle": "circle_alert",
"alert_octagon": "octagon_alert",
"alert_triangle": "triangle_alert",
"arrow_down_circle": "circle_arrow_down",
"arrow_down_left_from_circle": "circle_arrow_out_down_left",
"arrow_down_left_from_square": "square_arrow_out_down_left",
"arrow_down_left_square": "square_arrow_down_left",
"arrow_down_right_from_circle": "circle_arrow_out_down_right",
"arrow_down_right_from_square": "square_arrow_out_down_right",
"arrow_down_right_square": "square_arrow_down_right",
"arrow_down_square": "square_arrow_down",
"arrow_left_circle": "circle_arrow_left",
"arrow_left_square": "square_arrow_left",
"arrow_right_circle": "circle_arrow_right",
"arrow_right_square": "square_arrow_right",
"arrow_up_circle": "circle_arrow_up",
"arrow_up_left_from_circle": "circle_arrow_out_up_left",
"arrow_up_left_from_square": "square_arrow_out_up_left",
"arrow_up_left_square": "square_arrow_up_left",
"arrow_up_right_from_circle": "circle_arrow_out_up_right",
"arrow_up_right_from_square": "square_arrow_out_up_right",
"arrow_up_right_square": "square_arrow_up_right",
"arrow_up_square": "square_arrow_up",
"asterisk_square": "square_asterisk",
"check_circle": "circle_check_big",
"check_circle_2": "circle_check",
"check_square": "square_check_big",
"check_square_2": "square_check",
"chevron_down_circle": "circle_chevron_down",
"chevron_down_square": "square_chevron_down",
"chevron_left_circle": "circle_chevron_left",
"chevron_left_square": "square_chevron_left",
"chevron_right_circle": "circle_chevron_right",
"chevron_right_square": "square_chevron_right",
"chevron_up_circle": "circle_chevron_up",
"chevron_up_square": "square_chevron_up",
"code_2": "code_xml",
"code_square": "square_code",
"contact_2": "contact_round",
"divide_circle": "circle_divide",
"divide_square": "square_divide",
"dot_square": "square_dot",
"download_cloud": "cloud_download",
"equal_square": "square_equal",
"form_input": "rectangle_ellipsis",
"function_square": "square_function",
"gantt_chart_square": "square_gantt_chart",
"gauge_circle": "circle_gauge",
"globe_2": "earth",
"help_circle": "circle_help",
"helping_hand": "hand_helping",
"ice_cream": "ice_cream_cone",
"ice_cream_2": "ice_cream_bowl",
"indent": "indent_increase",
"kanban_square": "square_kanban",
"kanban_square_dashed": "square_dashed_kanban",
"laptop_2": "laptop_minimal",
"library_square": "square_library",
"loader_2": "loader_circle",
"m_square": "square_m",
"menu_square": "square_menu",
"mic_2": "mic_vocal",
"minus_circle": "circle_minus",
"minus_square": "square_minus",
"more_horizontal": "ellipsis",
"more_vertical": "ellipsis_vertical",
"mouse_pointer_square": "square_mouse_pointer",
"mouse_pointer_square_dashed": "square_dashed_mouse_pointer",
"outdent": "indent_decrease",
"palm_tree": "tree_palm",
"parking_circle": "circle_parking",
"parking_circle_off": "circle_parking_off",
"parking_square": "square_parking",
"parking_square_off": "square_parking_off",
"pause_circle": "circle_pause",
"pause_octagon": "octagon_pause",
"percent_circle": "circle_percent",
"percent_diamond": "diamond_percent",
"percent_square": "square_percent",
"pi_square": "square_pi",
"pilcrow_square": "square_pilcrow",
"play_circle": "circle_play",
"play_square": "square_play",
"plus_circle": "circle_plus",
"plus_square": "square_plus",
"power_circle": "circle_power",
"power_square": "square_power",
"school_2": "university",
"scissors_square": "square_scissors",
"scissors_square_dashed_bottom": "square_bottom_dashed_scissors",
"sigma_square": "square_sigma",
"slash_circle": "circle_slash",
"sliders": "sliders_vertical",
"split_square_horizontal": "square_split_horizontal",
"split_square_vertical": "square_split_vertical",
"stop_circle": "circle_stop",
"subtitles": "captions",
"test_tube_2": "test_tube_diagonal",
"unlock": "lock_open",
"unlock_keyhole": "lock_keyhole_open",
"upload_cloud": "cloud_upload",
"wallet_2": "wallet_minimal",
"wand_2": "wand_sparkles",
"x_circle": "circle_x",
"x_octagon": "octagon_x",
"x_square": "square_x",
}
LUCIDE_ICON_LIST = [
"a_arrow_down",
"a_arrow_up",

View File

@ -32,7 +32,6 @@ from reflex.style import (
set_color_mode,
toggle_color_mode,
)
from reflex.utils import console
from reflex.vars import Var
from .components.icon_button import IconButton
@ -100,7 +99,6 @@ class ColorModeIconButton(IconButton):
@classmethod
def create(
cls,
*children,
position: LiteralPosition | None = None,
allow_system: bool = False,
**props,
@ -108,7 +106,6 @@ class ColorModeIconButton(IconButton):
"""Create a icon button component that calls toggle_color_mode on click.
Args:
*children: The children of the component.
position: The position of the icon button. Follow document flow if None.
allow_system: Allow picking the "system" value for the color mode.
**props: The props to pass to the component.
@ -116,14 +113,6 @@ class ColorModeIconButton(IconButton):
Returns:
The button component.
"""
if children:
console.deprecate(
feature_name="passing children to color_mode.button",
reason=", use color_mode_cond and toggle_color_mode instead to build a custom color_mode component",
deprecation_version="0.5.0",
removal_version="0.6.0",
)
# position is used to set nice defaults for positioning the icon button
if isinstance(position, Var):
_set_var_default(props, position, "position", "fixed", position)

View File

@ -102,10 +102,6 @@ class ColorModeIconButton(IconButton):
def create( # type: ignore
cls,
*children,
position: Optional[
Literal["top-left", "top-right", "bottom-left", "bottom-right"]
] = None,
allow_system: Optional[bool] = False,
as_child: Optional[Union[Var[bool], bool]] = None,
size: Optional[
Union[
@ -280,7 +276,6 @@ class ColorModeIconButton(IconButton):
"""Create a icon button component that calls toggle_color_mode on click.
Args:
*children: The children of the component.
position: The position of the icon button. Follow document flow if None.
allow_system: Allow picking the "system" value for the color mode.
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.

View File

@ -4,15 +4,11 @@ from __future__ import annotations
from typing import Literal, Union
from reflex.components.base.fragment import Fragment
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.breakpoints import Responsive
from reflex.components.core.debounce import DebounceInput
from reflex.components.el import elements
from reflex.event import EventHandler
from reflex.ivars.base import LiteralVar
from reflex.style import Style, format_as_emotion
from reflex.utils import console
from reflex.vars import Var
from ..base import (
@ -107,80 +103,6 @@ class TextFieldRoot(elements.Div, RadixThemesComponent):
return DebounceInput.create(component)
return component
@classmethod
def create_root_deprecated(cls, *children, **props) -> Component:
"""Create a Fragment component (wrapper for deprecated name).
Copy the attributes that were previously defined on TextFieldRoot in 0.4.9 to
any child input elements (via custom_attrs).
Args:
*children: The children of the component.
**props: The properties of the component.
Returns:
The component.
"""
console.deprecate(
feature_name="rx.input.root",
reason="use rx.input without the .root suffix",
deprecation_version="0.5.0",
removal_version="0.6.0",
)
inputs = [
child
for child in children
if isinstance(child, (TextFieldRoot, DebounceInput))
]
if not inputs:
# Old-style where no explicit child input was provided
return cls.create(*children, **props)
slots = [child for child in children if isinstance(child, TextFieldSlot)]
carry_props = {
prop: props.pop(prop)
for prop in ["size", "variant", "color_scheme", "radius"]
if prop in props
}
template = cls.create(**props)
for child in inputs:
child.children.extend(slots)
custom_attrs = child.custom_attrs
custom_attrs.update(
{
prop: value
for prop, value in carry_props.items()
if prop not in custom_attrs and getattr(child, prop) is None
}
)
style = Style(template.style)
style.update(child.style)
child._get_style = lambda style=style: {
"css": LiteralVar.create(format_as_emotion(style))
}
for trigger in template.event_triggers:
if trigger not in child.event_triggers:
child.event_triggers[trigger] = template.event_triggers[trigger]
return Fragment.create(*inputs)
@classmethod
def create_input_deprecated(cls, *children, **props) -> Component:
"""Create a TextFieldRoot component (wrapper for deprecated name).
Args:
*children: The children of the component.
**props: The properties of the component.
Returns:
The component.
"""
console.deprecate(
feature_name="rx.input.input",
reason="use rx.input without the .input suffix",
deprecation_version="0.5.0",
removal_version="0.6.0",
)
return cls.create(*children, **props)
class TextFieldSlot(RadixThemesComponent):
"""Contains icons or buttons associated with an Input."""
@ -194,8 +116,6 @@ class TextFieldSlot(RadixThemesComponent):
class TextField(ComponentNamespace):
"""TextField components namespace."""
root = staticmethod(TextFieldRoot.create_root_deprecated)
input = staticmethod(TextFieldRoot.create_input_deprecated)
slot = staticmethod(TextFieldSlot.create)
__call__ = staticmethod(TextFieldRoot.create)

View File

@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Callable, Dict, Literal, Optional, Union, overload
from reflex.components.component import Component, ComponentNamespace
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
from reflex.event import EventHandler, EventSpec
@ -239,11 +239,6 @@ class TextFieldRoot(elements.Div, RadixThemesComponent):
"""
...
@classmethod
def create_root_deprecated(cls, *children, **props) -> Component: ...
@classmethod
def create_input_deprecated(cls, *children, **props) -> Component: ...
class TextFieldSlot(RadixThemesComponent):
@overload
@classmethod
@ -377,8 +372,6 @@ class TextFieldSlot(RadixThemesComponent):
...
class TextField(ComponentNamespace):
root = staticmethod(TextFieldRoot.create_root_deprecated)
input = staticmethod(TextFieldRoot.create_input_deprecated)
slot = staticmethod(TextFieldSlot.create)
@staticmethod

View File

@ -6,7 +6,6 @@ import contextlib
import dataclasses
import datetime
import dis
import functools
import inspect
import json
import random
@ -2532,7 +2531,6 @@ def computed_var(
auto_deps: bool = True,
interval: Optional[Union[datetime.timedelta, int]] = None,
backend: bool | None = None,
_deprecated_cached_var: bool = False,
**kwargs,
) -> ComputedVar | Callable[[Callable[[BaseState], Any]], ComputedVar]:
"""A ComputedVar decorator with or without kwargs.
@ -2545,7 +2543,6 @@ def computed_var(
auto_deps: Whether var dependencies should be auto-determined.
interval: Interval at which the computed var should be updated.
backend: Whether the computed var is a backend var.
_deprecated_cached_var: Indicate usage of deprecated cached_var partial function.
**kwargs: additional attributes to set on the instance
Returns:
@ -2555,14 +2552,6 @@ def computed_var(
ValueError: If caching is disabled and an update interval is set.
VarDependencyError: If user supplies dependencies without caching.
"""
if _deprecated_cached_var:
console.deprecate(
feature_name="cached_var",
reason=("Use @rx.var(cache=True) instead of @rx.cached_var."),
deprecation_version="0.5.6",
removal_version="0.6.0",
)
if cache is False and interval is not None:
raise ValueError("Cannot set update interval without caching.")
@ -2587,10 +2576,6 @@ def computed_var(
return wrapper
# Partial function of computed_var with cache=True
cached_var = functools.partial(computed_var, cache=True, _deprecated_cached_var=True)
class CallableVar(BaseVar):
"""Decorate a Var-returning function to act as both a Var and a function.

View File

@ -1,6 +1,6 @@
import pytest
from reflex.components.lucide.icon import LUCIDE_ICON_LIST, RENAMED_ICONS_05, Icon
from reflex.components.lucide.icon import LUCIDE_ICON_LIST, Icon
from reflex.utils import format
@ -10,16 +10,6 @@ def test_icon(tag):
assert icon.alias == f"Lucide{format.to_title_case(tag)}Icon"
RENAMED_TAGS = [tag for tag in RENAMED_ICONS_05.items()]
@pytest.mark.parametrize("tag, new_tag", RENAMED_TAGS)
def test_icon_renamed_tags(tag, new_tag):
Icon.create(tag)
# TODO: need a PR so we can pass the following test. Currently it fails and uses the old tag as the import.
# assert icon.alias == f"Lucide{format.to_title_case(new_tag)}Icon"
def test_icon_missing_tag():
with pytest.raises(AttributeError):
_ = Icon.create()

View File

@ -1613,62 +1613,6 @@ def test_rename_props():
assert 'renamed_prop3={"prop3_2"}' in rendered_c2["props"]
def test_deprecated_props(capsys):
"""Assert that deprecated underscore suffix props are translated.
Args:
capsys: Pytest fixture for capturing stdout and stderr.
"""
class C1(Component):
tag = "C1"
type: Var[str]
min: Var[str]
max: Var[str]
# No warnings are emitted when using the new prop names.
c1_1 = C1.create(type="type1", min="min1", max="max1")
out_err = capsys.readouterr()
assert not out_err.err
assert not out_err.out
c1_1_render = c1_1.render()
assert 'type={"type1"}' in c1_1_render["props"]
assert 'min={"min1"}' in c1_1_render["props"]
assert 'max={"max1"}' in c1_1_render["props"]
# Deprecation warning is emitted with underscore suffix,
# but the component still works.
c1_2 = C1.create(type_="type2", min_="min2", max_="max2")
out_err = capsys.readouterr()
assert out_err.out.count("DeprecationWarning:") == 3
assert not out_err.err
c1_2_render = c1_2.render()
assert 'type={"type2"}' in c1_2_render["props"]
assert 'min={"min2"}' in c1_2_render["props"]
assert 'max={"max2"}' in c1_2_render["props"]
class C2(Component):
tag = "C2"
type_: Var[str]
min_: Var[str]
max_: Var[str]
# No warnings are emitted if the actual prop has an underscore suffix
c2_1 = C2.create(type_="type1", min_="min1", max_="max1")
out_err = capsys.readouterr()
assert not out_err.err
assert not out_err.out
c2_1_render = c2_1.render()
assert 'type={"type1"}' in c2_1_render["props"]
assert 'min={"min1"}' in c2_1_render["props"]
assert 'max={"max1"}' in c2_1_render["props"]
def test_custom_component_get_imports():
class Inner(Component):
tag = "Inner"