From c5a30147c0999f37b93ab377659efe3803f22842 Mon Sep 17 00:00:00 2001 From: Binyamin Y Cohen <42520501+binyamin555@users.noreply.github.com> Date: Sun, 1 Feb 2026 00:21:06 +0200 Subject: [PATCH 1/2] Update Component.__init__ to allow for both Python and Flutter --- src/pydom/component.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pydom/component.py b/src/pydom/component.py index 736dba0..b1ace7b 100644 --- a/src/pydom/component.py +++ b/src/pydom/component.py @@ -1,5 +1,5 @@ from abc import abstractmethod, ABC -from typing import Tuple +from typing import overload, Iterable, Tuple from .types.rendering import RenderResult, ChildType @@ -7,8 +7,13 @@ class Component(ABC): children: Tuple["ChildType", ...] - def __init__(self, *children: "ChildType") -> None: - self.children = children + @overload + def __init__(self, *children: "ChildType") -> None: ... + @overload + def __init__(self, /, *, children: Iterable["ChildType"]) -> None: ... + + def __init__(self, *args, children=None) -> None: + self.children = children if children is not None else args @abstractmethod def render(self, *_, **kwargs) -> "RenderResult": ... From 82d86989942635bf13692ad3ba3c1a1c0aa3a46b Mon Sep 17 00:00:00 2001 From: Binyamin Y Cohen <42520501+binyamin555@users.noreply.github.com> Date: Sun, 1 Feb 2026 00:29:20 +0200 Subject: [PATCH 2/2] Update component.py --- src/pydom/component.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pydom/component.py b/src/pydom/component.py index b1ace7b..9dcc318 100644 --- a/src/pydom/component.py +++ b/src/pydom/component.py @@ -10,10 +10,10 @@ class Component(ABC): @overload def __init__(self, *children: "ChildType") -> None: ... @overload - def __init__(self, /, *, children: Iterable["ChildType"]) -> None: ... + def __init__(self, *, children: Iterable["ChildType"]) -> None: ... def __init__(self, *args, children=None) -> None: - self.children = children if children is not None else args + self.children = tuple(children) if children is not None else args @abstractmethod def render(self, *_, **kwargs) -> "RenderResult": ...