fleting 1.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fleting-1.1.4/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alex Yucra
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction...
fleting-1.1.4/PKG-INFO ADDED
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: fleting
3
+ Version: 1.1.4
4
+ Summary: Micro-framework MVC baseado em Flet para aplicações mobile, tablet e desktop
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: flet,framework,mvc,ui,desktop,mobile
8
+ Author: Alex Yucra
9
+ Requires-Python: >=3.11
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Dist: flet
15
+ Project-URL: Documentation, https://github.com/alexyucra/fleting/tree/main/docs
16
+ Project-URL: Homepage, https://github.com/alexyucra/fleting
17
+ Project-URL: Issues, https://github.com/alexyucra/fleting/issues
18
+ Project-URL: Repository, https://github.com/alexyucra/fleting
19
+ Description-Content-Type: text/markdown
20
+
21
+ <p align="center">
22
+ <a href="README.md">🇧🇷 Português</a> |
23
+ <a href="docs/readme-es.md">🇪🇸 Español</a> |
24
+ </p>
25
+
26
+ ---
27
+
28
+ # ⚡ Fleting Framework
29
+
30
+ ![](docs/img/fleting.png)
31
+
32
+ Fleting é um micro-framework opinativo construído sobre **Flet**, focado em:
33
+ - simplicidade
34
+ - organização clara
35
+ - produtividade
36
+ - aplicações multiplataforma (mobile, tablet e desktop)
37
+
38
+ Ele traz uma arquitetura inspirada em MVC, com **layout desacoplado**, **roteamento simples**, **i18n**, **responsividade automática** e um **CLI para geração de código**.
39
+
40
+ ## 🚀 Quick Start
41
+
42
+ ### 1. crie um ambiente virtual isolado
43
+
44
+ - [Recomendado: env com poetry](docs/pt/enviroment.md)
45
+
46
+
47
+ ## 🛠️ CLI
48
+
49
+ ```shell
50
+ pip install flet
51
+ pip install fleting
52
+
53
+ fleting init
54
+ fleting run
55
+
56
+ # para desenvolvimento
57
+ fleting create page home
58
+ flet run fleting/app.py
59
+ ```
60
+
61
+ ## 📚 Documentação
62
+
63
+ A documentação completa está disponível em:
64
+
65
+ 👉 [documentação completa](docs/pt/index.md)
66
+
67
+ ---
68
+
69
+ ## 🎯 Filosofia
70
+
71
+ O Fleting foi criado com alguns princípios claros:
72
+
73
+ ### 1️⃣ Simplicidade acima de tudo
74
+ - Nada de abstrações desnecessárias
75
+ - Código explícito e fácil de entender
76
+ - Arquitetura previsível
77
+
78
+ ### 2️⃣ Separação de responsabilidades
79
+ - **View** → UI pura (Flet)
80
+ - **Layout** → Estrutura visual reutilizável
81
+ - **Controller** → Regras de negócio
82
+ - **Model** → Dados
83
+ - **Router** → Navegação
84
+ - **Core** → Infraestrutura do framework
85
+
86
+ ### 3️⃣ Mobile-first
87
+ - O estado global da aplicação identifica automaticamente:
88
+ - `mobile`
89
+ - `tablet`
90
+ - `desktop`
91
+ - Layouts podem reagir dinamicamente ao tipo de dispositivo
92
+
93
+ ### 4️⃣ Internacionalização nativa
94
+ - Sistema de tradução simples baseado em JSON
95
+ - Mudança de idioma em tempo real
96
+ - Traduções acessíveis em qualquer parte da app
97
+
98
+ ### 5️⃣ CLI como cidadão de primeira classe
99
+ - Criação e remoção de arquivos padronizados
100
+ - Redução de boilerplate
101
+ - Convenção > Configuração
102
+
103
+ ---
104
+
105
+ ## 📄 Licença
106
+
107
+ MIT
108
+
109
+ ## Como contribuir
110
+ - [Para quem quiser contribuir com o Fleting no GitHub.](CONTRIBUTING.md)
@@ -0,0 +1,90 @@
1
+ <p align="center">
2
+ <a href="README.md">🇧🇷 Português</a> |
3
+ <a href="docs/readme-es.md">🇪🇸 Español</a> |
4
+ </p>
5
+
6
+ ---
7
+
8
+ # ⚡ Fleting Framework
9
+
10
+ ![](docs/img/fleting.png)
11
+
12
+ Fleting é um micro-framework opinativo construído sobre **Flet**, focado em:
13
+ - simplicidade
14
+ - organização clara
15
+ - produtividade
16
+ - aplicações multiplataforma (mobile, tablet e desktop)
17
+
18
+ Ele traz uma arquitetura inspirada em MVC, com **layout desacoplado**, **roteamento simples**, **i18n**, **responsividade automática** e um **CLI para geração de código**.
19
+
20
+ ## 🚀 Quick Start
21
+
22
+ ### 1. crie um ambiente virtual isolado
23
+
24
+ - [Recomendado: env com poetry](docs/pt/enviroment.md)
25
+
26
+
27
+ ## 🛠️ CLI
28
+
29
+ ```shell
30
+ pip install flet
31
+ pip install fleting
32
+
33
+ fleting init
34
+ fleting run
35
+
36
+ # para desenvolvimento
37
+ fleting create page home
38
+ flet run fleting/app.py
39
+ ```
40
+
41
+ ## 📚 Documentação
42
+
43
+ A documentação completa está disponível em:
44
+
45
+ 👉 [documentação completa](docs/pt/index.md)
46
+
47
+ ---
48
+
49
+ ## 🎯 Filosofia
50
+
51
+ O Fleting foi criado com alguns princípios claros:
52
+
53
+ ### 1️⃣ Simplicidade acima de tudo
54
+ - Nada de abstrações desnecessárias
55
+ - Código explícito e fácil de entender
56
+ - Arquitetura previsível
57
+
58
+ ### 2️⃣ Separação de responsabilidades
59
+ - **View** → UI pura (Flet)
60
+ - **Layout** → Estrutura visual reutilizável
61
+ - **Controller** → Regras de negócio
62
+ - **Model** → Dados
63
+ - **Router** → Navegação
64
+ - **Core** → Infraestrutura do framework
65
+
66
+ ### 3️⃣ Mobile-first
67
+ - O estado global da aplicação identifica automaticamente:
68
+ - `mobile`
69
+ - `tablet`
70
+ - `desktop`
71
+ - Layouts podem reagir dinamicamente ao tipo de dispositivo
72
+
73
+ ### 4️⃣ Internacionalização nativa
74
+ - Sistema de tradução simples baseado em JSON
75
+ - Mudança de idioma em tempo real
76
+ - Traduções acessíveis em qualquer parte da app
77
+
78
+ ### 5️⃣ CLI como cidadão de primeira classe
79
+ - Criação e remoção de arquivos padronizados
80
+ - Redução de boilerplate
81
+ - Convenção > Configuração
82
+
83
+ ---
84
+
85
+ ## 📄 Licença
86
+
87
+ MIT
88
+
89
+ ## Como contribuir
90
+ - [Para quem quiser contribuir com o Fleting no GitHub.](CONTRIBUTING.md)
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,29 @@
1
+
2
+ import flet as ft
3
+ from configs.app_config import AppConfig
4
+ from core.logger import get_logger
5
+ from core.error_handler import GlobalErrorHandler
6
+
7
+ logger = get_logger("App")
8
+
9
+ def main(page: ft.Page):
10
+ try:
11
+ from core.app import FletingApp
12
+ page.window.width = AppConfig.DEFAULT_SCREEN["width"]
13
+ page.window.height = AppConfig.DEFAULT_SCREEN["height"]
14
+
15
+ from core.i18n import I18n
16
+ I18n.load("pt")
17
+
18
+ from core.router import Router
19
+ from configs.routes import routes
20
+
21
+ router = Router(page)
22
+ router.navigate("/")
23
+
24
+ logger.info("Aplicação iniciada com sucesso")
25
+
26
+ except Exception as e:
27
+ GlobalErrorHandler.handle(page, e)
28
+
29
+ ft.run(main)
@@ -0,0 +1,58 @@
1
+ import sys
2
+ from fleting.cli.commands.init import handle_init
3
+ from fleting.cli.commands.run import handle_run
4
+ from fleting.cli.commands.info import handle_info
5
+ from fleting.cli.commands.create import handle_create
6
+ from fleting.cli.commands.delete import handle_delete
7
+
8
+ def print_help():
9
+ print("""
10
+ Fleting CLI
11
+
12
+ Uso:
13
+ fleting init
14
+ Inicializa um novo projeto Fleting
15
+
16
+ fleting create page <nome>
17
+ Cria uma nova página (model + controller + view)
18
+
19
+ fleting create view <nome>
20
+ fleting create model <nome>
21
+ fleting create controller <nome>
22
+
23
+ fleting delete page <nome>
24
+ fleting delete view <nome>
25
+ fleting delete model <nome>
26
+ fleting delete controller <nome>
27
+ """)
28
+
29
+ def main():
30
+
31
+ args = sys.argv[1:]
32
+
33
+ if not args or args[0] in ("-h", "--help"):
34
+ print_help()
35
+ return
36
+
37
+ command = args[0]
38
+
39
+ try:
40
+ if command == "init":
41
+ handle_init()
42
+ elif command == "run":
43
+ handle_run()
44
+ elif command == "info":
45
+ handle_info()
46
+ elif command == "create":
47
+ handle_create(args[1:])
48
+ elif command == "delete":
49
+ handle_delete(args[1:])
50
+ else:
51
+ print(f"Comando desconhecido: {command}")
52
+ print_help()
53
+
54
+ except Exception as e:
55
+ print("Erro ao executar comando CLI:", str(e))
56
+
57
+ if __name__ == "__main__":
58
+ main()
@@ -0,0 +1,159 @@
1
+ from pathlib import Path
2
+
3
+ BASE = Path.cwd()
4
+
5
+ def handle_create(args):
6
+ if len(args) < 2:
7
+ print("Uso: fleting create <controller|view|model|page> <nome>")
8
+ return
9
+
10
+ kind, name = args[0], args[1]
11
+ name = name.lower()
12
+
13
+ try:
14
+ if kind == "controller":
15
+ create_controller(name)
16
+ elif kind == "view":
17
+ create_view(name)
18
+ elif kind == "model":
19
+ create_model(name)
20
+ elif kind == "page":
21
+ create_page(name)
22
+ else:
23
+ print(f"Tipo não suportado: {kind}")
24
+
25
+ except Exception:
26
+ print(f"Erro ao criar {kind} {name}")
27
+
28
+ # --------------
29
+ # create controller
30
+ # --------------
31
+ def create_controller(name: str):
32
+ path = BASE / "controllers" / f"{name}_controller.py"
33
+
34
+ if path.exists():
35
+ print(f"Controller '{name}' já existe")
36
+ return
37
+
38
+ class_name = f"{name.capitalize()}Controller"
39
+
40
+ content = f"""class {class_name}:
41
+ def __init__(self, model=None):
42
+ self.model = model
43
+
44
+ def get_title(self):
45
+ return "{name.capitalize()}"
46
+ """
47
+ path.write_text(content, encoding="utf-8")
48
+ print(f"Controller criado com sucesso: {name}")
49
+
50
+
51
+ # --------------
52
+ # create view
53
+ # --------------
54
+ def create_view(name: str):
55
+ path = BASE / "views" / "pages" / f"{name}_view.py"
56
+
57
+ if path.exists():
58
+ print(f"View '{name}' já existe")
59
+ return
60
+
61
+ class_name = f"{name.capitalize()}View"
62
+
63
+ content = f"""import flet as ft
64
+ from views.layouts.main_layout import MainLayout
65
+
66
+ class {class_name}:
67
+ def __init__(self, page, router):
68
+ self.page = page
69
+ self.router = router
70
+
71
+ def render(self):
72
+ content = ft.Column(
73
+ controls=[
74
+ ft.Text("{name.capitalize()}", size=24),
75
+ ],
76
+ spacing=16,
77
+ )
78
+
79
+ return MainLayout(
80
+ page=self.page,
81
+ content=content,
82
+ router=self.router,
83
+ )
84
+ """
85
+
86
+ path.write_text(content, encoding="utf-8")
87
+ print(f"View criada com sucesso: {name}")
88
+
89
+
90
+ # --------------
91
+ # create model
92
+ # --------------
93
+ def create_model(name: str):
94
+ path = BASE / "models" / f"{name}_model.py"
95
+
96
+ if path.exists():
97
+ print(f"Model '{name}' já existe")
98
+ return
99
+
100
+ class_name = f"{name.capitalize()}Model"
101
+
102
+ content = f"""class {class_name}:
103
+ def __init__(self):
104
+ pass
105
+ """
106
+
107
+ path.write_text(content, encoding="utf-8")
108
+ print(f"Model criado com sucesso: {name}")
109
+
110
+ # --------------
111
+ # create page
112
+ # --------------
113
+ def create_page(name: str):
114
+ print(f"Criando page completa: {name}")
115
+
116
+ create_model(name)
117
+ create_controller(name)
118
+ create_page_view(name)
119
+
120
+ def create_page_view(name: str):
121
+ path = BASE / "views" / "pages" / f"{name}_view.py"
122
+
123
+ if path.exists():
124
+ print(f"View '{name}' já existe")
125
+ return
126
+
127
+ class_name = f"{name.capitalize()}View"
128
+ controller_class = f"{name.capitalize()}Controller"
129
+ model_class = f"{name.capitalize()}Model"
130
+
131
+ content = f"""import flet as ft
132
+ from views.layouts.main_layout import MainLayout
133
+ from controllers.{name}_controller import {controller_class}
134
+ from models.{name}_model import {model_class}
135
+
136
+ class {class_name}:
137
+ def __init__(self, page, router):
138
+ self.page = page
139
+ self.router = router
140
+
141
+ self.model = {model_class}()
142
+ self.controller = {controller_class}(self.model)
143
+
144
+ def render(self):
145
+ content = ft.Column(
146
+ controls=[
147
+ ft.Text(self.controller.get_title(), size=24),
148
+ ],
149
+ spacing=16,
150
+ )
151
+
152
+ return MainLayout(
153
+ page=self.page,
154
+ content=content,
155
+ router=self.router,
156
+ )
157
+ """
158
+ path.write_text(content, encoding="utf-8")
159
+ print(f"Page criada com sucesso: {name}")
@@ -0,0 +1,76 @@
1
+ from pathlib import Path
2
+
3
+ BASE = Path.cwd()
4
+
5
+ def handle_delete(args):
6
+ if len(args) < 2:
7
+ print("Uso: fleting delete <controller|view|model|page> <nome>")
8
+ return
9
+
10
+ kind, name = args[0], args[1].lower()
11
+
12
+ try:
13
+ if kind == "view":
14
+ delete_view(name)
15
+
16
+ elif kind == "controller":
17
+ delete_controller(name)
18
+
19
+ elif kind == "model":
20
+ delete_model(name)
21
+
22
+ elif kind == "page":
23
+ delete_page(name)
24
+
25
+ else:
26
+ print(f"Tipo não suportado: {kind}")
27
+
28
+ except Exception:
29
+ print(f"Erro ao deletar {kind} {name}")
30
+
31
+ # -----------------
32
+ # delete controller
33
+ # -----------------
34
+ def delete_controller(name: str):
35
+ path = BASE / "controllers" / f"{name}_controller.py"
36
+
37
+ if not path.exists():
38
+ print(f"Controller '{name}' não existe")
39
+ return
40
+
41
+ path.unlink()
42
+ print(f"Controller removido com sucesso: {name}")
43
+
44
+ # -----------------
45
+ # delete view
46
+ # -----------------
47
+ def delete_view(name: str):
48
+ path = BASE / "views" / "pages" / f"{name}_view.py"
49
+
50
+ if not path.exists():
51
+ print(f"View '{name}' não existe")
52
+ return
53
+
54
+ path.unlink()
55
+ print(f"View removida com sucesso: {name}")
56
+
57
+ # -----------------
58
+ # delete model
59
+ # -----------------
60
+ def delete_model(name: str):
61
+ path = BASE / "models" / f"{name}_model.py"
62
+
63
+ if not path.exists():
64
+ print(f"Model '{name}' não existe")
65
+ return
66
+
67
+ path.unlink()
68
+ print(f"Model removido com sucesso: {name}")
69
+
70
+ # -----------------
71
+ # delete page
72
+ # -----------------
73
+ def delete_page(name: str):
74
+ delete_view(name)
75
+ delete_controller(name)
76
+ delete_model(name)
@@ -0,0 +1,44 @@
1
+ import platform
2
+ import sys
3
+ from importlib import metadata
4
+
5
+ BANNER = r"""
6
+ ______ _ _ _
7
+ | ____| | | | (_)
8
+ | |__ | | ___| |_ _ _ __ __ _
9
+ | __| | |/ _ \ __| | '_ \ / _` |
10
+ | | | | __/ |_| | | | | (_| |
11
+ |_| |_|\___|\__|_|_| |_|\__, |
12
+ __/ |
13
+ |___/
14
+ """
15
+
16
+ def _get_version(pkg_name: str):
17
+ try:
18
+ return metadata.version(pkg_name)
19
+ except metadata.PackageNotFoundError:
20
+ return "não instalado"
21
+
22
+ def handle_info():
23
+ python_version = sys.version.split()[0]
24
+ system = f"{platform.system()} {platform.release()}"
25
+
26
+ flet_version = _get_version("flet")
27
+ fleting_version = _get_version("fleting")
28
+
29
+ print(BANNER)
30
+ print("🚀 Fleting Framework\n")
31
+
32
+ print("📦 Ambiente\n")
33
+ print(f"🧠 Python : {python_version}")
34
+ print(f"🖥️ Sistema : {system}")
35
+ print(f"🧩 Flet : {flet_version}")
36
+ print(f"🚀 Fleting : {fleting_version}")
37
+
38
+ print("\n📚 Bibliotecas instaladas:")
39
+ for dist in sorted(metadata.distributions(), key=lambda d: d.metadata["Name"].lower()):
40
+ name = dist.metadata["Name"]
41
+ version = dist.version
42
+ print(f" - {name}=={version}")
43
+
44
+ print("\n✅ Ambiente pronto para uso.\n")
@@ -0,0 +1,4 @@
1
+ from fleting.cli.templates.index import init_project
2
+
3
+ def handle_init():
4
+ init_project()
@@ -0,0 +1,28 @@
1
+ import subprocess
2
+ import sys
3
+ import shutil
4
+ from pathlib import Path
5
+
6
+ def handle_run():
7
+ project_root = Path.cwd()
8
+ app_path = project_root / "fleting" / "app.py"
9
+
10
+ if not shutil.which("flet"):
11
+ print("❌ Flet não está instalado no ambiente")
12
+ print("👉 pip install flet")
13
+ return
14
+
15
+ if not app_path.exists():
16
+ print("❌ fleting/app.py não encontrado.")
17
+ print("👉 Execute 'fleting init' primeiro.")
18
+ return
19
+
20
+ print("🚀 Iniciando aplicação Fleting...\n")
21
+
22
+ try:
23
+ subprocess.run(
24
+ ["flet", "run", str(app_path)],
25
+ check=True
26
+ )
27
+ except subprocess.CalledProcessError:
28
+ print("❌ Erro ao executar o app com Flet")