From 15552dfc930f9f2d65b2763547200f5c60722a88 Mon Sep 17 00:00:00 2001 From: #Einswilli Date: Sun, 28 Dec 2025 12:25:18 +0000 Subject: [PATCH] Pytthon support. --- .python-version | 2 +- PYPI.md | 2 +- README.md | 2 +- fletx/core/di.py | 9 +-------- fletx/core/effects.py | 1 - fletx/core/route_config.py | 1 - fletx/core/router.py | 1 - fletx/core/routing/config.py | 13 ++----------- fletx/core/routing/router.py | 6 +----- fletx/core/services.py | 2 +- fletx/core/state.py | 8 ++------ fletx/core/widget.py | 1 - fletx/utils/logger.py | 1 - pyproject.toml | 8 ++++++-- 14 files changed, 16 insertions(+), 41 deletions(-) diff --git a/.python-version b/.python-version index 494c9d1..232dced 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -==3.12.* +>=3.10,<=3.13 diff --git a/PYPI.md b/PYPI.md index d0341cb..f8eaca7 100644 --- a/PYPI.md +++ b/PYPI.md @@ -60,7 +60,7 @@ Perfect for building **desktop, web, and mobile apps** with Python at lightning ## Quick Start 🏁 -> NOTE: FletX currently supports Python 3.12 only. Compatibility with newer versions is in progress — we're actively working to expand support soon. +> NOTE: FletX currently supports Python `>=3.10,<=3.13`. Compatibility with newer versions is in progress — we're actively working to expand support soon. ### Installation ```bash diff --git a/README.md b/README.md index 0cb9f4a..3e6c88e 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Perfect for building **desktop, web, and mobile apps** with Python at lightning ## Quick Start 🏁 -> NOTE: FletX currently supports Python 3.12 only. Compatibility with newer versions is in progress — we're actively working to expand support soon. +> NOTE: FletX currently supports Python `>=3.10,<=3.13`. Compatibility with newer versions is in progress — we're actively working to expand support soon. ### Installation ```bash diff --git a/fletx/core/di.py b/fletx/core/di.py index e85fbbd..2601ffd 100644 --- a/fletx/core/di.py +++ b/fletx/core/di.py @@ -26,14 +26,7 @@ class DI: """ _instances: Dict[str, Any] = {} - _logger: ClassVar[logging.Logger] = get_logger("FletX.DI") - - @classmethod - @property - def logger(cls): - if not cls._logger: - cls._logger = get_logger('FletX.DI') - return cls._logger + logger: ClassVar[logging.Logger] = get_logger("FletX.DI") @classmethod def put(cls, instance: T, tag: Optional[str] = None) -> T: diff --git a/fletx/core/effects.py b/fletx/core/effects.py index 2922eca..e507053 100644 --- a/fletx/core/effects.py +++ b/fletx/core/effects.py @@ -87,7 +87,6 @@ def __init__(self, effect_fn: Callable, dependencies: List[Any] = None): self._last_deps = None self._logger = get_logger("FletX.Effect") - @classmethod @property def logger(cls): if not cls._logger: diff --git a/fletx/core/route_config.py b/fletx/core/route_config.py index 2f05f67..f6474c7 100644 --- a/fletx/core/route_config.py +++ b/fletx/core/route_config.py @@ -21,7 +21,6 @@ class RouteConfig: _routes: Dict[str, Type[FletXPage]] = {} # pragma: no cover _logger = get_logger(__name__) - @classmethod @property def logger(cls): if not cls._logger: diff --git a/fletx/core/router.py b/fletx/core/router.py index 82db4e4..9b241dc 100644 --- a/fletx/core/router.py +++ b/fletx/core/router.py @@ -47,7 +47,6 @@ class FletXRouter: _middleware = RouteMiddleware() _guards: Dict[str, List[RouteGuard]] = {} - @classmethod @property def logger(cls): if not cls._logger: diff --git a/fletx/core/routing/config.py b/fletx/core/routing/config.py index 0a2fd23..3a7c454 100644 --- a/fletx/core/routing/config.py +++ b/fletx/core/routing/config.py @@ -91,19 +91,14 @@ def match(self, path: str) -> Optional[Dict[str, str]]: class RouterConfig: """Advanced router configuration manager.""" - _logger = get_logger('FletX.RouterConfig') - def __init__(self): self._routes: Dict[str, RouteDefinition] = {} self._route_patterns: List[tuple[RoutePattern, RouteDefinition]] = [] self._modules: Dict[str, 'ModuleRouter'] = {} - @classmethod @property def logger(cls): - if not cls._logger: - cls._logger = get_logger('FletX.RouterConfig') - return cls._logger + return get_logger('FletX.RouterConfig') def add_route( self, @@ -278,13 +273,9 @@ def __init__(self): # Add subrouters self.add_subrouters(self.sub_routers) - self._logger = get_logger(f'FletX.ModuleRouter.{self.name}') - @property def logger(self): - if not self._logger: - self._logger = get_logger(f'FletX.ModuleRouter.{self.name}') - return self._logger + return get_logger(f'FletX.ModuleRouter.{self.name}') def add_route( self, diff --git a/fletx/core/routing/router.py b/fletx/core/routing/router.py index ea6203e..f663bd0 100644 --- a/fletx/core/routing/router.py +++ b/fletx/core/routing/router.py @@ -46,7 +46,6 @@ class FletXRouter: """ _instance: Optional['FletXRouter'] = None - _logger = get_logger('FletX.Router') def __init__( self, @@ -72,12 +71,9 @@ def __init__( # an old version of fletx router self.to = self.navigate - @classmethod @property def logger(cls): - if not cls._logger: - cls._logger = get_logger('FletX.Router') - return cls._logger + return get_logger('FletX.Router') @classmethod def get_instance(cls) -> 'FletXRouter': diff --git a/fletx/core/services.py b/fletx/core/services.py index fbf96c5..bb1e081 100644 --- a/fletx/core/services.py +++ b/fletx/core/services.py @@ -342,4 +342,4 @@ def __str__(self) -> str: def __repr__(self) -> str: return (f"FletXService(name='{self._name}', state={self._state.value}, " - f"created_at={self._created_at.isoformat()})") \ No newline at end of file + f"created_at={self._created_at.isoformat()})") diff --git a/fletx/core/state.py b/fletx/core/state.py index 04acb58..9cf5361 100644 --- a/fletx/core/state.py +++ b/fletx/core/state.py @@ -67,13 +67,10 @@ def __init__( self.active = True self.auto_dispose = auto_dispose self._dependencies = set() - self._logger = get_logger("FletX.Observer") @property def logger(self): - if not self._logger: - self._logger = get_logger('FletX.Observer') - return self._logger + return get_logger('FletX.Observer') def add_dependency(self, dependency): """ @@ -129,7 +126,6 @@ def __init__(self, initial_value: T): self._value = initial_value self._observers: Set[Observer] = set() - @classmethod @property def logger(cls): if not cls._logger: @@ -437,4 +433,4 @@ def clear(self): Removes all keys and values from the dictionary, leaving it empty. """ self._value.clear() - self._notify_observers() \ No newline at end of file + self._notify_observers() diff --git a/fletx/core/widget.py b/fletx/core/widget.py index b4f032e..23fcfcf 100644 --- a/fletx/core/widget.py +++ b/fletx/core/widget.py @@ -49,7 +49,6 @@ def __init_subclass__(cls, **kwargs): FletXWidgetRegistry.register(cls) cls.page.update() - @classmethod @property def logger(cls): if not cls._logger: diff --git a/fletx/utils/logger.py b/fletx/utils/logger.py index 1ac87bd..df4b347 100644 --- a/fletx/utils/logger.py +++ b/fletx/utils/logger.py @@ -31,7 +31,6 @@ def get_logger(cls, name: str = "FletX") -> logging.Logger: return cls._logger @property - @classmethod def logger(self) -> logging.Logger: return self.get_logger() diff --git a/pyproject.toml b/pyproject.toml index 188a38a..43d0e14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ readme = "PYPI.md" license = {file = "LICENSE"} authors = [{ name = "AllDotPy", email = "hello@alldotpy.com" }] maintainers = [{ name = "#Einswilli", email = "einswilligoeh@email.com" }] -requires-python = "==3.12.*" +requires-python = ">=3.10,<=3.13" keywords = [ "fletx", "fletxr", "flet", "reactive state", "routing", "di", "dependency injection" @@ -28,7 +28,7 @@ Repository = "https://github.com/AllDotPy/FletX" Documentation = "https://alldotpy.github.io/FletX" Tracker = "https://github.com/AllDotPy/FletX/issues" -[project.optional-dependencies] +[dependency-groups] dev = [ "black", "mypy", @@ -36,6 +36,7 @@ dev = [ "uv", "build", "pytest>=8.4.0", + "pytest-asyncio>=1.3.0", "mkdocs>=1.6.1", "setuptools>=80.8.0", "mkdocs-material>=9.6.14", @@ -45,6 +46,9 @@ dev = [ [tool.setuptools] packages = ["fletx"] +[tool.pytest.ini_options] +asyncio_mode = "auto" + [build-system] requires = ["setuptools>=61.0", "wheel"] build-backend = "setuptools.build_meta"