Skip to content

Commit dbcc0dd

Browse files
authored
refactor: Reorganizing pyproject.toml to fix build error "No matching…
refactor: Reorganizing pyproject.toml to fix build error "No matching…
2 parents 6eddc91 + 38765db commit dbcc0dd

17 files changed

Lines changed: 73 additions & 67 deletions

File tree

PYPI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Perfect for building **desktop, web, and mobile apps** with Python at lightning
6464
6565
### Installation
6666
```bash
67-
pip install FletXr --pre
67+
pip install FletXr[dev] --pre
6868
```
6969

7070
### Create project

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Perfect for building **desktop, web, and mobile apps** with Python at lightning
8989
9090
### Installation
9191
```bash
92-
pip install FletXr --pre
92+
pip install FletXr[dev] --pre
9393
```
9494

9595
### Create project

docs/getting-started/installation.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ This guide will walk you through:
1515
Before starting, make sure you have:
1616

1717
* Python 3.12
18-
* `pip` (Python package manager)
18+
* Python package manager
19+
* `uv` (recommanded)
20+
* `pip`
1921

2022
---
2123

2224
## 📦 Installation
2325

2426
```bash
25-
pip install flet fletxr
27+
pip install fletxr[dev]
2628
```
2729

2830
> ✅ This will install both Flet and FletX. `fletxr` is the official package name on PyPI.
@@ -31,7 +33,7 @@ pip install flet fletxr
3133

3234
## 🧪 Creating Your First App
3335

34-
You can either start manually or use the FletX CLI. Let’s explore both options:
36+
You can either start manually or use the FletX CLI to scaffold a new project. Let’s explore both options:
3537

3638
### Option 1: Manual Setup
3739

@@ -46,7 +48,7 @@ from fletx.core import (
4648
)
4749
from fletx.navigation import router_config
4850
from fletx.decorators import (
49-
simple_reactive
51+
obx
5052
)
5153

5254

@@ -56,30 +58,29 @@ class CounterController(FletXController):
5658
self.count = RxInt(0)
5759
super().__init__()
5860

59-
60-
@simple_reactive(bindings={'value': 'text'})
61-
class MyReactiveText(ft.Text):
62-
63-
def __init__(self, rx_text: RxStr, **kwargs):
64-
self.text: RxStr = rx_text
65-
super().__init__(**kwargs)
66-
67-
6861
class CounterPage(FletXPage):
6962
ctrl = CounterController()
7063

64+
@obx
65+
def counter_text(self):
66+
return ft.Text(
67+
value=f'Count: {self.ctrl.count}',
68+
size=50,
69+
weight="bold",
70+
color='red' if not self.ctrl.count.value % 2 == 0 else 'white'
71+
)
72+
7173
def build(self):
7274
return ft.Column(
7375
controls=[
74-
MyReactiveText(rx_text=self.ctrl.count, size=200, weight="bold"),
76+
self.counter_text(),
7577
ft.ElevatedButton(
7678
"Increment",
7779
on_click=lambda e: self.ctrl.count.increment()
7880
)
7981
]
8082
)
8183

82-
8384
def main():
8485
router_config.add_route(path='/', component=CounterPage)
8586
app = FletXApp(
@@ -90,7 +91,7 @@ def main():
9091
ft.Theme(color_scheme_seed=ft.Colors.BLUE)
9192
)
9293

93-
app.run()
94+
app.run_async()
9495

9596

9697
if __name__ == "__main__":

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ FletX is built on 3 core principles:
5555

5656
## ⚡ Quick Example
5757

58+
```python
5859
import flet as ft
5960

6061
from fletx.app import FletXApp

fletx/cli/templates/project/pyproject.toml.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ requires-python = ">={{ python_version }}"
99
# Dependencies
1010
dependencies = [
1111
"fletxr=={{ fletx_version }}",
12-
"flet[all]==0.28.3",
13-
]
12+
"flet==0.28.3",
13+
]

fletx/core/page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import flet as ft
99
from typing import (
10-
Union, List, Optional, Any, Dict, Type, TypeVar, Callable, Tuple
10+
Union, List, Optional, Any, Dict, Type, TypeVar, Callable
1111
)
1212
from abc import ABC, abstractmethod
1313
from fletx.core.controller import FletXController
@@ -65,7 +65,7 @@ def __init__(
6565
self.route_info: Optional[RouteInfo] = None
6666
self._controllers: Dict[str, FletXController] = {}
6767
self._effects = EffectManager()
68-
self._logger = get_logger(f"FletX.Page.{self.__class__.__name__}")
68+
self._logger = get_logger(f"FletXPage.{self.__class__.__name__}")
6969
self._state = PageState.INITIALIZING
7070
self._safe_area = safe_area
7171
self._auto_dispose_controllers = auto_dispose_controllers

fletx/core/routing/router.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
"""
88

99
import flet as ft
10-
from typing import Dict, Any, Optional, List, Union, Callable
10+
from typing import Dict, Any, Optional, List, Callable
1111
from urllib.parse import parse_qs, urlparse
1212
import asyncio
13-
from contextlib import asynccontextmanager
1413

1514
from fletx.core.routing.models import (
1615
RouteInfo, NavigationIntent, RouterState, NavigationMode,
@@ -73,7 +72,7 @@ def __init__(
7372

7473
@property
7574
def logger(cls):
76-
return get_logger('FletX.Router')
75+
return get_logger('FletXRouter')
7776

7877
@classmethod
7978
def get_instance(cls) -> 'FletXRouter':
@@ -266,7 +265,7 @@ def go_back(self) -> bool:
266265
"""Navigate back in history."""
267266

268267
if not self.state.history:
269-
self._logger.warning("No previous route in history")
268+
self.logger.warning("No previous route in history")
270269
return False
271270

272271
previous_route = self.state.history.pop()
@@ -282,7 +281,7 @@ def go_forward(self) -> bool:
282281
"""Navigate forward in history."""
283282

284283
if not self.state.forward_stack:
285-
self._logger.warning("No forward route in history")
284+
self.logger.warning("No forward route in history")
286285
return False
287286

288287
forward_route = self.state.forward_stack.pop()
@@ -327,11 +326,11 @@ def add_global_middleware(
327326

328327
self._global_middleware.append(middleware)
329328

330-
def set_navigation_mode(self, mode: NavigationMode):
329+
def set_navigation_mode(self, mode: NavigationMode): # noqa: F811
331330
"""Set navigation mode for Flet integration."""
332331

333332
self.state.navigation_mode = mode
334-
self._logger.debug(f"Navigation mode set to: {mode}")
333+
self.logger.debug(f"Navigation mode set to: {mode}")
335334

336335
# @worker_task(priority = Priority.HIGH)
337336
async def _check_deactivation_guards(self) -> bool:
@@ -442,7 +441,7 @@ async def _resolve_route_data(
442441
else:
443442
resolved_data[key] = resolver(route_info)
444443
except Exception as e:
445-
self._logger.error(f"Data resolver failed for {key}: {e}")
444+
self.logger.error(f"Data resolver failed for {key}: {e}")
446445

447446
return resolved_data
448447

@@ -538,7 +537,7 @@ async def _apply_transition_and_update(
538537
else:
539538
component.did_mount()
540539
except Exception as e:
541-
self._logger.error(f"did_mount() failed: {e}")
540+
self.logger.error(f"did_mount() failed: {e}")
542541

543542
def _get_default_transition(self, route_def) -> Optional[RouteTransition]:
544543
"""Get default transition for route."""

fletx/core/state.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66

77
import logging
88
from typing import (
9-
Any, Callable, ClassVar, List, Generic, TypeVar, Dict, Optional,
10-
Set, Union
9+
Callable, ClassVar, List, Generic, TypeVar, Dict,
10+
Set
1111
)
12-
from abc import ABC, abstractmethod
1312
from fletx.utils import get_logger
1413

1514
T = TypeVar('T')
@@ -157,6 +156,10 @@ def value(self, new_value: T):
157156
self._value = new_value
158157
self._notify_observers()
159158
self.logger.debug(f"Value changed: {old_value}{new_value}")
159+
160+
def set(self, new_value: T):
161+
"""Sets a new value"""
162+
self.value = new_value
160163

161164
def listen(
162165
self,

fletx/decorators/controllers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88

99
from fletx import FletX
10-
from typing import Type, Callable, Optional
10+
from typing import Type, Callable, Optional # noqa: F401
1111
from functools import wraps
1212
from fletx.core.page import FletXPage
1313
from fletx.core.controller import FletXController

fletx/decorators/reactive.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@
66
facilitating seamless UI updates.
77
"""
88

9-
import flet as ft
109
import asyncio
1110
import time
1211
from typing import (
1312
Callable, Any, TypeVar, Dict, Union,
1413
List, Optional, Tuple, Set
1514
)
1615
from functools import wraps
17-
from weakref import WeakSet
18-
1916

2017
from fletx.core.state import (
2118
Reactive, ReactiveDependencyTracker, Computed,
@@ -73,14 +70,14 @@ def reactive_batch():
7370
```python
7471
@reactive_batch()
7572
def batch_update(items: RxList):
76-
# Multiple rapid changes will be batched together
73+
# Multiple rapid changes will be batched
7774
update_list_display(items.value)
7875
```
7976
"""
8077
def decorator(func: F) -> F:
8178
@wraps(func)
8279
def wrapper(*args, **kwargs):
83-
update_fn = lambda: func(*args, **kwargs)
80+
update_fn = lambda: func(*args, **kwargs) # noqa: E731
8481
_batch_manager.add_update(update_fn)
8582
logger.debug(f"Batched {func.__name__} for next tick")
8683

@@ -167,7 +164,6 @@ def wrapper(*args, **kwargs):
167164
return result
168165

169166
# Track dependencies during computation
170-
from fletx.core import ReactiveDependencyTracker
171167
result, dependencies = ReactiveDependencyTracker.track(
172168
lambda: func(*args, **kwargs)
173169
)
@@ -403,7 +399,6 @@ def decorator(func: F) -> F:
403399
def wrapper(*args, **kwargs):
404400
# Auto-detect dependencies if not provided
405401
if dependencies is None:
406-
from fletx.core import ReactiveDependencyTracker
407402
result, deps = ReactiveDependencyTracker.track(
408403
lambda: func(*args, **kwargs)
409404
)
@@ -463,7 +458,6 @@ def full_name():
463458
# full_name is now a Reactive[str] that updates automatically
464459
"""
465460
def decorator(func: F) -> Reactive:
466-
from fletx.core.state import Computed
467461
return Computed(func, dependencies)
468462

469463
return decorator

0 commit comments

Comments
 (0)