Guarana-aag 0.0.1__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Alessandro Guarita
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, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include LICENSE
2
+ include README.md
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.1
2
+ Name: Guarana_aag
3
+ Version: 0.0.1
4
+ Summary: Front-End para uso no Python
5
+ Author-email: Alessandro Guarita <alessandro.guarita@gmail.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.13.0
11
+ License-File: LICENSE
12
+ Requires-Dist: colorama
13
+ Requires-Dist: flask
14
+ Requires-Dist: markdown
@@ -0,0 +1,4 @@
1
+ # Guaraná
2
+ Baseado no Front_Alego, gem de Ruby que desenvolvi para a Assembleia Legislativa do Estado de Goiás, esse módulo Python instala um front_end funcional para módulos Flask ou mesmo para HTML estático, que dá a base para trabalhar, sem limitar com um estilo fixo caso decida alterar, mas também permite fazer um site rápido com mudanças mínimas.
3
+
4
+ [Changelog](changelog.md)
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0, <69.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "Guarana_aag"
7
+ version = "0.0.1"
8
+ authors = [
9
+ { name = "Alessandro Guarita", email = "alessandro.guarita@gmail.com" },
10
+ ]
11
+ description = "Front-End para uso no Python"
12
+ requires-python = ">=3.13.0"
13
+ dependencies = [
14
+ 'colorama',
15
+ 'flask',
16
+ 'markdown'
17
+ ]
18
+
19
+ license = { text = "MIT" }
20
+ classifiers = [
21
+ "Programming Language :: Python :: 3",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Operating System :: OS Independent",
24
+ ]
25
+
26
+ [tool.setuptools.packages.find]
27
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.1
2
+ Name: Guarana-aag
3
+ Version: 0.0.1
4
+ Summary: Front-End para uso no Python
5
+ Author-email: Alessandro Guarita <alessandro.guarita@gmail.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.13.0
11
+ License-File: LICENSE
12
+ Requires-Dist: colorama
13
+ Requires-Dist: flask
14
+ Requires-Dist: markdown
@@ -0,0 +1,19 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ src/Guarana_aag.egg-info/PKG-INFO
6
+ src/Guarana_aag.egg-info/SOURCES.txt
7
+ src/Guarana_aag.egg-info/dependency_links.txt
8
+ src/Guarana_aag.egg-info/requires.txt
9
+ src/Guarana_aag.egg-info/top_level.txt
10
+ src/guarana/__init__.py
11
+ src/guarana/__main__.py
12
+ src/guarana/config.py
13
+ src/guarana/comandos/__init__.py
14
+ src/guarana/comandos/criar_flask.py
15
+ src/guarana/comandos/helpers.py
16
+ src/guarana/origem/rodar.py
17
+ src/guarana/origem/app/__init__.py
18
+ src/guarana/origem/app/config.py
19
+ src/guarana/origem/app/routes.py
@@ -0,0 +1,3 @@
1
+ colorama
2
+ flask
3
+ markdown
File without changes
@@ -0,0 +1,27 @@
1
+ import argparse
2
+
3
+ from . import comandos
4
+ from .config import *
5
+
6
+ descricao = f"{NOME}: estrutura de front-end para Flask. Versão: {VERSAO}"
7
+
8
+ def criar_flask():
9
+ comandos.criar_flask()
10
+
11
+ def main():
12
+ parser = argparse.ArgumentParser(description=descricao)
13
+ subparsers = parser.add_subparsers(dest='comando')
14
+
15
+ flask = subparsers.add_parser(
16
+ 'flask',
17
+ help=f'Cria a estrutura padrão para app de Flask. Inclui o comando de instalação'
18
+ )
19
+
20
+ args = parser.parse_args()
21
+ match args.comando:
22
+ case 'flask': criar_flask()
23
+ case _: parser.print_help()
24
+
25
+ if __name__ == "__main__":
26
+ main()
27
+
@@ -0,0 +1 @@
1
+ from .criar_flask import criar_flask
@@ -0,0 +1,29 @@
1
+ from pathlib import Path
2
+
3
+ from ..config import *
4
+ from .helpers import criar_pasta, copiar_arquivo, copiar_pasta_inteira
5
+
6
+ def criar_flask():
7
+ criar_pasta('app')
8
+ criar_pasta('app/templates')
9
+ criar_pasta('app/static')
10
+
11
+ criar_requirements()
12
+ copiar_arquivo('rodar.py', 'rodar.py')
13
+ copiar_pasta_inteira('app', 'app')
14
+ copiar_pasta_inteira('templates', 'app/templates')
15
+
16
+
17
+ def criar_requirements():
18
+ arquivo = 'requirements.txt'
19
+ arquivo_origem = PASTA_ORIGEM / arquivo
20
+ conteudo = Path.read_text(arquivo_origem)
21
+ conteudo += f'{APP}=={VERSAO}'
22
+
23
+ arquivo_final = Path(arquivo)
24
+ if arquivo_final.exists():
25
+ print(
26
+ f'Arquivo {COR_VERMELHO}{arquivo}{COR_FIM} já existe, não foi criado')
27
+ else:
28
+ arquivo_final.write_text(conteudo, encoding='utf-8')
29
+ print(f'Arquivo {COR_AMARELO}{arquivo}{COR_FIM} criado')
@@ -0,0 +1,34 @@
1
+ from pathlib import Path
2
+
3
+ from ..config import *
4
+
5
+
6
+ def criar_pasta(pasta):
7
+ pasta = Path(pasta)
8
+
9
+ if not pasta.exists():
10
+ pasta.mkdir()
11
+ print(f'Pasta {COR_AMARELO}{pasta}{COR_FIM} criada')
12
+
13
+ def copiar_arquivo(origem, destino):
14
+ arquivo_origem = PASTA_ORIGEM / origem
15
+ conteudo = Path.read_text(arquivo_origem)
16
+
17
+ arquivo_final = Path(destino)
18
+ if arquivo_final.exists():
19
+ print(
20
+ f'Arquivo {COR_VERMELHO}{destino}{COR_FIM} já existe e não foi recriado')
21
+ else:
22
+ arquivo_final.write_text(conteudo, encoding='utf-8')
23
+ print(f'Arquivo {COR_AMARELO}{destino}{COR_FIM} criado')
24
+
25
+ def copiar_pasta_inteira(origem, destino):
26
+ pasta_origem = PASTA_ORIGEM / origem
27
+ arquivos = list(pasta_origem.glob('*'))
28
+
29
+ for arquivo in arquivos:
30
+ copiar_arquivo(
31
+ f"{origem}/{str(arquivo.name)}",
32
+ f'{destino}/{str(arquivo.name)}')
33
+
34
+
@@ -0,0 +1,33 @@
1
+ import tomllib
2
+ import colorama
3
+ from pathlib import Path
4
+
5
+ try:
6
+ _PROJETO = Path(__file__).parent.parent.parent / 'pyproject.toml'
7
+ with open(_PROJETO, 'rb') as arquivo:
8
+ _PROJETO_TOML = tomllib.load(arquivo)
9
+ # Pega os dados da seção [project do TOML]
10
+ PROJETO_METADATA = _PROJETO_TOML.get("project", {})
11
+ except (FileNotFoundError, tomllib.TOMLDecodeError):
12
+ # Fallback caso o arquivo não seja encontrado ou seja inválido
13
+ PROJETO_METADATA = {}
14
+
15
+ APP = PROJETO_METADATA.get('name', 'Front_End_Base')
16
+ NOME = APP.replace('_aag', '')
17
+ VERSAO = PROJETO_METADATA.get('version', '0.0.0-dev')
18
+ _autores = PROJETO_METADATA.get('authors', [{'name': 'Alessandro Guarita'}])
19
+ AUTOR = _autores[0].get('name', 'Alessandro Guarita') if _autores else 'Alessandro Guarita'
20
+
21
+ PORTA_LOCAL = 5000
22
+
23
+ PASTA_ORIGEM = Path(__file__).parent / 'origem'
24
+
25
+
26
+ COR_AMARELO = colorama.Fore.YELLOW
27
+ COR_VERMELHO = colorama.Fore.RED
28
+ COR_AZUL = colorama.Fore.BLUE
29
+ COR_VERDE = colorama.Fore.GREEN
30
+ COR_BRANCO = colorama.Fore.WHITE
31
+
32
+ COR_FUNDO_VERMELHO = colorama.Back.RED
33
+ COR_FIM = colorama.Style.RESET_ALL
@@ -0,0 +1,6 @@
1
+ from flask import Flask
2
+
3
+ app = Flask(__name__)
4
+
5
+ from app import routes
6
+
@@ -0,0 +1,8 @@
1
+ # QUAL FOLHA DE ESTILO USAR
2
+ _ESTILOS = {
3
+ 'padrao': 'css/estilo.css',
4
+ 'compacto': 'css/compacto.css'
5
+ }
6
+ ESTILO = _ESTILOS.get('padrao', 'css/estilo.scss')
7
+
8
+ TITULO = 'Nome do App'
@@ -0,0 +1,21 @@
1
+ from flask import render_template
2
+
3
+ from app import app
4
+ from config import *
5
+
6
+
7
+ @app.route('/')
8
+ def index():
9
+ return render_template(
10
+ 'index.html',
11
+ titulo=TITULO,
12
+ estilo = ESTILO
13
+ )
14
+
15
+ @app.route('/login')
16
+ def login():
17
+ return render_template(
18
+ 'login.html',
19
+ titulo=f'{TITULO} - Entrar',
20
+ estilo = ESTILO
21
+ )
@@ -0,0 +1,4 @@
1
+ from app import app
2
+
3
+ if __name__ == '__main__':
4
+ app.run(debug=True, host='0.0.0.0', port=3000)