Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix version in pyproject and ruff version check #4690

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 260 additions & 4 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ keywords = ["web", "framework"]
classifiers = ["Development Status :: 4 - Beta"]

[tool.poetry.dependencies]
python = "^3.10"
python = ">=3.10, <4.0"
fastapi = ">=0.96.0,!=0.111.0,!=0.111.1"
gunicorn = ">=20.1.0,<24.0"
jinja2 = ">=3.1.2,<4.0"
Expand Down Expand Up @@ -82,7 +82,7 @@ build-backend = "poetry.core.masonry.api"
[tool.pyright]

[tool.ruff]
target-version = "py39"
target-version = "py310"
output-format = "concise"
lint.isort.split-on-trailing-comma = false
lint.select = ["B", "C4", "D", "E", "ERA", "F", "FURB", "I", "N", "PERF", "PTH", "RUF", "SIM", "T", "TRY", "W"]
Expand Down
8 changes: 6 additions & 2 deletions reflex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,10 @@ def _check_routes_conflict(self, new_route: str):
for route in self._pages:
replaced_route = replace_brackets_with_keywords(route)
for rw, r, nr in zip(
replaced_route.split("/"), route.split("/"), new_route.split("/")
replaced_route.split("/"),
route.split("/"),
new_route.split("/"),
strict=False,
):
if rw in segments and r != nr:
# If the slugs in the segments of both routes are not the same, then the route is invalid
Expand Down Expand Up @@ -1039,7 +1042,7 @@ def get_compilation_time() -> str:
max_workers=environment.REFLEX_COMPILE_THREADS.get() or None
)

for route, component in zip(self._pages, page_components):
for route, component in zip(self._pages, page_components, strict=True):
ExecutorSafeFunctions.COMPONENTS[route] = component

ExecutorSafeFunctions.STATE = self._state
Expand Down Expand Up @@ -1236,6 +1239,7 @@ def _validate_exception_handlers(self):
frontend_arg_spec,
backend_arg_spec,
],
strict=True,
):
if hasattr(handler_fn, "__name__"):
_fn_name = handler_fn.__name__
Expand Down
4 changes: 3 additions & 1 deletion reflex/components/core/breakpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def create(
return Breakpoints(
{
k: v
for k, v in zip(["initial", *breakpoint_names], thresholds)
for k, v in zip(
["initial", *breakpoint_names], thresholds, strict=True
)
if v is not None
}
)
Expand Down
4 changes: 2 additions & 2 deletions reflex/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def __call__(self, *args: Any) -> EventSpec:
raise EventHandlerTypeError(
f"Arguments to event handlers must be Vars or JSON-serializable. Got {arg} of type {type(arg)}."
) from e
payload = tuple(zip(fn_args, values))
payload = tuple(zip(fn_args, values, strict=False))

# Return the event spec.
return EventSpec(
Expand Down Expand Up @@ -337,7 +337,7 @@ def add_args(self, *args: Var) -> EventSpec:
raise EventHandlerTypeError(
f"Arguments to event handlers must be Vars or JSON-serializable. Got {arg} of type {type(arg)}."
) from e
new_payload = tuple(zip(fn_args, values))
new_payload = tuple(zip(fn_args, values, strict=False))
return self.with_args(self.args + new_payload)


Expand Down
1 change: 1 addition & 0 deletions reflex/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,7 @@ def _get_common_ancestor(cls, other: Type[BaseState]) -> str:
for part1, part2 in zip(
cls.get_full_name().split("."),
other.get_full_name().split("."),
strict=True,
):
if part1 != part2:
break
Expand Down
10 changes: 7 additions & 3 deletions reflex/utils/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,9 @@ def _isinstance(obj: Any, cls: GenericType, nested: bool = False) -> bool:
return (
isinstance(obj, tuple)
and len(obj) == len(args)
and all(_isinstance(item, arg) for item, arg in zip(obj, args))
and all(
_isinstance(item, arg) for item, arg in zip(obj, args, strict=True)
)
)
if origin in (dict, Breakpoints):
return isinstance(obj, dict) and all(
Expand Down Expand Up @@ -808,7 +810,7 @@ def wrapper(*args, **kwargs):
annotations = {param[0]: param[1].annotation for param in func_params}

# validate args
for param, arg in zip(annotations, args):
for param, arg in zip(annotations, args, strict=False):
if annotations[param] is inspect.Parameter.empty:
continue
validate_literal(param, arg, annotations[param], func.__name__)
Expand Down Expand Up @@ -906,6 +908,8 @@ def typehint_issubclass(possible_subclass: Any, possible_superclass: Any) -> boo
# It also ignores when the length of the arguments is different
return all(
typehint_issubclass(provided_arg, accepted_arg)
for provided_arg, accepted_arg in zip(provided_args, accepted_args)
for provided_arg, accepted_arg in zip(
provided_args, accepted_args, strict=False
)
if accepted_arg is not Any
)
2 changes: 1 addition & 1 deletion reflex/vars/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2723,7 +2723,7 @@ def generic_type_to_actual_type_map(
# call recursively for nested generic types and merge the results
return {
k: v
for generic_arg, actual_arg in zip(generic_args, actual_args)
for generic_arg, actual_arg in zip(generic_args, actual_args, strict=True)
for k, v in generic_type_to_actual_type_map(generic_arg, actual_arg).items()
}

Expand Down
2 changes: 1 addition & 1 deletion tests/units/compiler/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_compile_imports(import_dict: ParsedImportDict, test_dicts: List[dict]):
test_dicts: The expected output.
"""
imports = utils.compile_imports(import_dict)
for import_dict, test_dict in zip(imports, test_dicts):
for import_dict, test_dict in zip(imports, test_dicts, strict=True):
assert import_dict["lib"] == test_dict["lib"]
assert import_dict["default"] == test_dict["default"]
assert sorted(import_dict["rest"]) == test_dict["rest"] # type: ignore
Expand Down
2 changes: 2 additions & 0 deletions tests/units/components/test_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,7 @@ def test_get_vars(component, exp_vars):
for comp_var, exp_var in zip(
comp_vars,
sorted(exp_vars, key=lambda v: v._js_expr),
strict=True,
):
assert comp_var.equals(exp_var)

Expand Down Expand Up @@ -1827,6 +1828,7 @@ class TestComponent(Component):
for v1, v2 in zip(
parse_args_spec(test_triggers[trigger_name]),
parse_args_spec(custom_triggers[trigger_name]),
strict=True,
):
assert v1.equals(v2)

Expand Down
3 changes: 3 additions & 0 deletions tests/units/test_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def var_raises_at_runtime_child(self) -> str:
"state.local",
"local2",
],
strict=True,
),
)
def test_full_name(prop, expected):
Expand All @@ -205,6 +206,7 @@ def test_full_name(prop, expected):
zip(
test_vars,
["prop1", "key", "state.value", "state.local", "local2"],
strict=True,
),
)
def test_str(prop, expected):
Expand Down Expand Up @@ -251,6 +253,7 @@ def test_default_value(prop: Var, expected):
"state.set_local",
"set_local2",
],
strict=True,
),
)
def test_get_setter(prop: Var, expected):
Expand Down
Loading