aecode 0.2.0__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.
- aecode-0.2.0/CHANGELOG.md +45 -0
- aecode-0.2.0/CONTRIBUTING.md +62 -0
- aecode-0.2.0/LICENSE +21 -0
- aecode-0.2.0/MANIFEST.in +6 -0
- aecode-0.2.0/PKG-INFO +214 -0
- aecode-0.2.0/README.md +189 -0
- aecode-0.2.0/aecode/__init__.py +7 -0
- aecode-0.2.0/aecode/api_engine.py +161 -0
- aecode-0.2.0/aecode/cli.py +61 -0
- aecode-0.2.0/aecode/flow_engine.py +138 -0
- aecode-0.2.0/aecode/ui_engine.py +661 -0
- aecode-0.2.0/aecode/web_engine.py +85 -0
- aecode-0.2.0/aecode.egg-info/PKG-INFO +214 -0
- aecode-0.2.0/aecode.egg-info/SOURCES.txt +28 -0
- aecode-0.2.0/aecode.egg-info/dependency_links.txt +1 -0
- aecode-0.2.0/aecode.egg-info/entry_points.txt +2 -0
- aecode-0.2.0/aecode.egg-info/requires.txt +4 -0
- aecode-0.2.0/aecode.egg-info/top_level.txt +1 -0
- aecode-0.2.0/examples/api_demo.ae +2 -0
- aecode-0.2.0/examples/dashboard.ae +8 -0
- aecode-0.2.0/examples/landing.ae +14 -0
- aecode-0.2.0/examples/paint.ae +6 -0
- aecode-0.2.0/examples/scraper.ae +16 -0
- aecode-0.2.0/pyproject.toml +37 -0
- aecode-0.2.0/setup.cfg +4 -0
- aecode-0.2.0/setup.py +5 -0
- aecode-0.2.0/tests/test_api.py +50 -0
- aecode-0.2.0/tests/test_flow.py +23 -0
- aecode-0.2.0/tests/test_ui.py +56 -0
- aecode-0.2.0/tests/test_web.py +31 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Todos los cambios notables en este proyecto serán documentados en este archivo.
|
|
4
|
+
|
|
5
|
+
El formato está basado en [Keep a Changelog](https://keepachangelog.com/es-ES/1.0.0/),
|
|
6
|
+
y este proyecto se adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [0.2.0] - 2026-10-01
|
|
11
|
+
|
|
12
|
+
### Agregado
|
|
13
|
+
- **Migración a Lark en AeUI**:
|
|
14
|
+
- Gramática formal EBNF con Lark para parsing de toda la sintaxis de interfaces.
|
|
15
|
+
- Soporte completo para anidamientos complejos (e.g. `GRID 2 { FORM "..." CANVAS ... }`).
|
|
16
|
+
- **AeAPI Engine**:
|
|
17
|
+
- Consumo declarativo de APIs REST y GraphQL en una sola línea.
|
|
18
|
+
- Soporte de pipelines: `DATA = GET "url" | SELECT field1, field2.subfield as alias | filter(field > 0)`.
|
|
19
|
+
- Soporte de mutaciones `POST` y queries `GRAPHQL`.
|
|
20
|
+
- Nuevo comando en CLI: `aecode api <archivo.ae>`.
|
|
21
|
+
- **AeUI v2 Interactive Mode (Canvas / Mini-Paint)**:
|
|
22
|
+
- Soporte de primitivas interactivas: `CANVAS WxH`, `PALETTE [...]`, `SIZES [...]`, `TOOLS [...]`.
|
|
23
|
+
- Motor de dibujo vanilla en JavaScript (mouse y touch) con descarga de imagen PNG (`toDataURL`).
|
|
24
|
+
- **Extensión Oficial para VS Code (`vscode-aecode`)**:
|
|
25
|
+
- Resaltado de sintaxis TextMate para archivos `.ae` con reconocimiento de todos los motores.
|
|
26
|
+
- Configuración de brackets, autocompletado y comentarios.
|
|
27
|
+
- **Regla de Contexto para Agentes de IA (`.agents/rules/aecode.md`)**:
|
|
28
|
+
- Configuración nativa para que asistentes de código reconozcan el formato `.ae` de forma automática.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## [0.1.0] - 2026-10-01
|
|
33
|
+
|
|
34
|
+
### Agregado
|
|
35
|
+
- **AeWeb Engine**:
|
|
36
|
+
- Operadores de extracción CSS directos (`>` y `@`).
|
|
37
|
+
- Transformaciones funcionales `|` (Map), `|?` (Filter) y `|*` (FlatMap multihilo).
|
|
38
|
+
- Función de auto-paginación inteligente `CRAWL(url, next_selector, max_pages)`.
|
|
39
|
+
- **AeUI Engine**:
|
|
40
|
+
- Compilador de layouts declarativos a HTML5 con Tailwind CSS integrado vía CDN.
|
|
41
|
+
- Componentes `PAGE`, `NAV`, `HERO`, `GRID`, `CARD`, `BTN`, `FOOTER`.
|
|
42
|
+
- **AeFlow Engine**:
|
|
43
|
+
- Orquestación end-to-end de Scraping + Renderizado en 3 líneas de código (`SCRAPE -> GRID -> RENDER`).
|
|
44
|
+
- **CLI Global (`aecode`)**:
|
|
45
|
+
- `aecode scrape`, `aecode build`, `aecode flow`, `aecode doctor`.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Contributing to AeCode ⚡
|
|
2
|
+
|
|
3
|
+
¡Gracias por tu interés en contribuir a AeCode! Nuestro objetivo es erradicar el boilerplate y la inflación de tokens en agentes de IA y flujos de desarrollo modernos.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🎯 Filosofía del Proyecto
|
|
8
|
+
|
|
9
|
+
1. **Tokens son Dinero y Latencia**: Cada carácter cuenta. Si algo puede expresarse en 5 tokens en lugar de 50, se diseña así.
|
|
10
|
+
2. **Cero Boilerplate**: Menos imports, menos wrappers innecesarios, más declaratividad funcional.
|
|
11
|
+
3. **Componibilidad**: Los motores (`web_engine`, `ui_engine`, `flow_engine`) deben poder encadenarse de manera intuitiva.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 🚀 Cómo Agregar un Nuevo Motor (Ej: `AeAPI`)
|
|
16
|
+
|
|
17
|
+
AeCode está diseñado para ser modular. Para crear un nuevo motor (por ejemplo, `AeAPI` para interactuar con APIs REST o GraphQL):
|
|
18
|
+
|
|
19
|
+
1. **Crear el motor** en `aecode/api_engine.py`:
|
|
20
|
+
- Implementa funciones funcionales y limpias (ej: `ae_fetch(endpoint, method, headers)`).
|
|
21
|
+
2. **Registrar comandos CLI** en `aecode/cli.py`:
|
|
22
|
+
- Agrega un subcomando `@main.command()` para ejecutar archivos `.aeapi`.
|
|
23
|
+
3. **Agregar tests** en `tests/test_api.py`.
|
|
24
|
+
4. **Actualizar la documentación** en `README.md` con benchmarks de tokens ahorrados.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 🛠️ Entorno de Desarrollo Local
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# 1. Clonar el repositorio
|
|
32
|
+
git clone https://github.com/aecode-lang/aecode.git
|
|
33
|
+
cd aecode
|
|
34
|
+
|
|
35
|
+
# 2. Crear entorno virtual
|
|
36
|
+
uv venv # o python -m venv .venv
|
|
37
|
+
source .venv/bin/activate # En Windows: .venv\Scripts\activate
|
|
38
|
+
|
|
39
|
+
# 3. Instalar en modo editable con herramientas de test
|
|
40
|
+
uv pip install -e ".[dev]" pytest
|
|
41
|
+
|
|
42
|
+
# 4. Correr la suite de pruebas
|
|
43
|
+
python -m pytest tests/
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 📝 Estilo de Código y Estándares
|
|
49
|
+
|
|
50
|
+
- Código limpio, legible y tipado donde aporte valor sin sobrecargar.
|
|
51
|
+
- Mantener las dependencias directas al mínimo (`requests`, `beautifulsoup4`, `lark`, `click`).
|
|
52
|
+
- Los tests deben pasar al 100% antes de abrir un PR.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 🔀 Flujo de Pull Requests
|
|
57
|
+
|
|
58
|
+
1. Haz un fork del repositorio.
|
|
59
|
+
2. Crea una rama descriptiva (`git checkout -b feature/nuevo-operador`).
|
|
60
|
+
3. Haz commit de tus cambios (`git commit -m 'feat: agrega operador de streaming'`).
|
|
61
|
+
4. Sube tu rama (`git push origin feature/nuevo-operador`).
|
|
62
|
+
5. Abre un Pull Request describiendo el caso de uso y cuántos tokens ahorra.
|
aecode-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AeCode Contributors
|
|
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.
|
aecode-0.2.0/MANIFEST.in
ADDED
aecode-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aecode
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: DSL ultra-compacto para scraping, UI y APIs. Ahorra 95% de tokens en agentes de IA.
|
|
5
|
+
Author: AeCode Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Eduardo2345wet/aecode
|
|
8
|
+
Project-URL: Repository, https://github.com/Eduardo2345wet/aecode
|
|
9
|
+
Keywords: dsl,ai,agents,scraping,tailwind,api,tokens,llm
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: requests>=2.31
|
|
21
|
+
Requires-Dist: beautifulsoup4>=4.12
|
|
22
|
+
Requires-Dist: lark>=1.1
|
|
23
|
+
Requires-Dist: click>=8.1
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
<div align="center">
|
|
27
|
+
|
|
28
|
+
# ⚡ AeCode
|
|
29
|
+
|
|
30
|
+
### The Ultra-Compressed DSL for Web Scraping & UI Generation.
|
|
31
|
+
**Save up to 95% of LLM Tokens. Reduce latency by 10x.**
|
|
32
|
+
|
|
33
|
+
[](https://pypi.org/project/aecode/)
|
|
34
|
+
[](https://pypi.org/project/aecode/)
|
|
35
|
+
[](https://opensource.org/licenses/MIT)
|
|
36
|
+
[](https://pypi.org/project/aecode/)
|
|
37
|
+
[](https://github.com/aecode-lang/aecode/actions)
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<a href="#-the-problem-llm-token-inflation">Why AeCode?</a> •
|
|
41
|
+
<a href="#-quick-start">Quick Start</a> •
|
|
42
|
+
<a href="#-syntax-reference">Syntax</a> •
|
|
43
|
+
<a href="#-benchmarks">Benchmarks</a> •
|
|
44
|
+
<a href="#-examples">Examples</a>
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🤯 The Problem: LLM Token Inflation
|
|
52
|
+
|
|
53
|
+
Current AI Coding Agents (Claude 3.5, GPT-4o, Gemini Pro) spend **90% of their output tokens** writing:
|
|
54
|
+
- Hundreds of lines of repetitive `import requests`, `BeautifulSoup` boilerplate.
|
|
55
|
+
- Tedious HTML boilerplate, `<!DOCTYPE html>`, Tailwind classes strings, and nested loop syntax.
|
|
56
|
+
- Verbose CSS selector traversals and error-handling blocks.
|
|
57
|
+
|
|
58
|
+
**The result?** Higher API bills, sluggish response times, context window exhaustion, and higher chances of hallucinated syntax.
|
|
59
|
+
|
|
60
|
+
### 💡 The Solution: AeCode
|
|
61
|
+
|
|
62
|
+
**AeCode** compresses complex web workflows into high-density mathematical & functional primitives. An AI model writes **10 lines** of AeCode; the engine compiles and executes it as **200+ lines** of production Python + Tailwind CSS.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 🥊 Real Code Comparison
|
|
67
|
+
|
|
68
|
+
### Task: Scrape 20 Products and Render a Live Dashboard
|
|
69
|
+
|
|
70
|
+
#### ❌ The Python + HTML Traditional Way (285 Tokens)
|
|
71
|
+
```python
|
|
72
|
+
import csv, requests
|
|
73
|
+
from bs4 import BeautifulSoup
|
|
74
|
+
|
|
75
|
+
resp = requests.get("http://books.toscrape.com")
|
|
76
|
+
soup = BeautifulSoup(resp.text, 'html.parser')
|
|
77
|
+
books = []
|
|
78
|
+
for pod in soup.select(".product_pod"):
|
|
79
|
+
t = pod.select_one("h3 > a")["title"]
|
|
80
|
+
p = pod.select_one(".price_color").text
|
|
81
|
+
books.append({"title": t, "price": p})
|
|
82
|
+
|
|
83
|
+
html = """<!DOCTYPE html><html><head><script src="https://cdn.tailwindcss.com"></script></head><body class="bg-gray-900 text-white p-8"><div class="grid grid-cols-4 gap-6">"""
|
|
84
|
+
for b in books:
|
|
85
|
+
html += f"""<div class="bg-gray-800 p-4 rounded-xl border border-gray-700"><h3 class="font-bold">{b['title']}</h3><p class="text-amber-400 font-bold">{b['price']}</p></div>"""
|
|
86
|
+
html += "</div></body></html>"
|
|
87
|
+
with open("view.html", "w") as f: f.write(html)
|
|
88
|
+
import webbrowser; webbrowser.open("view.html")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### ✅ The AeCode Way (32 Tokens — 89% Ahorro)
|
|
92
|
+
```text
|
|
93
|
+
DATA = SCRAPE("http://books.toscrape.com", ".product_pod", [title: "h3 > a" @ "title", price: ".price_color" @ "text"])
|
|
94
|
+
VIEW = GRID 4 > CARD(title, price) FROM DATA
|
|
95
|
+
RENDER VIEW
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 📊 Benchmarks
|
|
101
|
+
|
|
102
|
+
| Task | Traditional Python | AeCode | Token Savings |
|
|
103
|
+
|:---|:---:|:---:|:---:|
|
|
104
|
+
| Basic Web Scraping | ~180 tokens | **48 tokens** | **-73%** |
|
|
105
|
+
| Multithreaded Parallel FlatMap | ~280 tokens | **60 tokens** | **-78%** |
|
|
106
|
+
| Auto-Pagination (Crawl) | ~320 tokens | **52 tokens** | **-84%** |
|
|
107
|
+
| Tailwind Landing Page | ~500 tokens | **25 tokens** | **-95%** |
|
|
108
|
+
| Live Scrape-to-UI Dashboard | ~600 tokens | **35 tokens** | **-94%** |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## ⚡ Quick Start
|
|
113
|
+
|
|
114
|
+
### 1. Installation
|
|
115
|
+
```bash
|
|
116
|
+
pip install aecode
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 2. Verify Your System
|
|
120
|
+
```bash
|
|
121
|
+
aecode doctor
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 3. Run Your First Flow
|
|
125
|
+
```bash
|
|
126
|
+
aecode flow examples/dashboard.ae
|
|
127
|
+
```
|
|
128
|
+
*Voilà! It automatically scrapes live data, builds an interactive Tailwind CSS UI, and opens it directly in your default browser.*
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 🧭 Three Engines in One DSL
|
|
133
|
+
|
|
134
|
+
### 1. 🌐 AeWeb (Scraping & Data Extraction)
|
|
135
|
+
```text
|
|
136
|
+
doc = GET("http://books.toscrape.com")
|
|
137
|
+
items = doc > ".product_pod"
|
|
138
|
+
rows = items | λi. {title: (i > "h3 > a") @ "title", price: (i > ".price_color") @ "text"}
|
|
139
|
+
rows => "libros.csv"
|
|
140
|
+
```
|
|
141
|
+
```bash
|
|
142
|
+
aecode scrape examples/scraper.ae
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 2. 🎨 AeUI (Declarative Web Layouts)
|
|
146
|
+
```text
|
|
147
|
+
PAGE /home
|
|
148
|
+
NAV [MiMarca, Links(Productos, Precios, Contacto)]
|
|
149
|
+
HERO "Bienvenido al futuro" center
|
|
150
|
+
GRID 3 > CARD(title, desc, price)
|
|
151
|
+
BTN "Empezar ahora"
|
|
152
|
+
FOOTER
|
|
153
|
+
```
|
|
154
|
+
```bash
|
|
155
|
+
aecode build examples/landing.ae --output index.html
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 3. ⚡ AeFlow (End-to-End Scraping to Web App)
|
|
159
|
+
```text
|
|
160
|
+
DATA = SCRAPE("http://books.toscrape.com", ".product_pod", [title: "h3 > a" @ "title", price: ".price_color" @ "text"])
|
|
161
|
+
VIEW = GRID 4 > CARD(title, price) FROM DATA
|
|
162
|
+
RENDER VIEW
|
|
163
|
+
```
|
|
164
|
+
```bash
|
|
165
|
+
aecode flow examples/dashboard.ae
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 📐 Syntax Reference
|
|
171
|
+
|
|
172
|
+
| Operator / Primitiva | Descripción | Ejemplo |
|
|
173
|
+
|:---|:---|:---|
|
|
174
|
+
| `GET(url)` | Petición HTTP + Parseo HTML | `doc = GET("https://...")` |
|
|
175
|
+
| `>` | Selector CSS | `items = doc > ".product_pod"` |
|
|
176
|
+
| `@` | Extracción de atributo o texto | `(el > "a") @ "href"` o `@ "text"` |
|
|
177
|
+
| `\|` | Map funcional sobre colecciones | `items \| λi. { ... }` |
|
|
178
|
+
| `\|?` | Filtro funcional booleano | `items \|? λi. num(i @ "text") > 50` |
|
|
179
|
+
| `\|*` | FlatMap concurrente multihilo | `urls \|* λu. (GET(u) > ".pod")` |
|
|
180
|
+
| `CRAWL(url, fn, max)` | Auto-paginación secuencial segura | `CRAWL(url, λd. d > "li.next > a" @ "href", 5)` |
|
|
181
|
+
| `SCRAPE(...)` | Extracción masiva estructurada | `SCRAPE(url, selector, [fields])` |
|
|
182
|
+
| `GRID n > CARD(...)` | Cuadrícula responsiva Tailwind | `GRID 4 > CARD(title, price)` |
|
|
183
|
+
| `RENDER view` | Compilación y apertura web | `RENDER VIEW` |
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 🧠 Philosophy: Mathematical Brevity > Verbosity
|
|
188
|
+
|
|
189
|
+
Programming languages designed in the 1990s were made for human keyboards. In 2026, code is generated by AI agents collaborating with humans.
|
|
190
|
+
|
|
191
|
+
- **Tokens are compute.**
|
|
192
|
+
- **Tokens are latency.**
|
|
193
|
+
- **Tokens are cost.**
|
|
194
|
+
|
|
195
|
+
AeCode treats code like mathematical equations: dense, declarative, composable, and crystal clear.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## 📈 Star History
|
|
200
|
+
|
|
201
|
+
[](https://star-history.com/#aecode-lang/aecode&Date)
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 🤝 Community & Support
|
|
206
|
+
|
|
207
|
+
- 🌟 Star the repository on [GitHub](https://github.com/aecode-lang/aecode)
|
|
208
|
+
- 💬 Discuss on [HackerNews](https://news.ycombinator.com) and [Reddit (r/Python)](https://reddit.com/r/Python)
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## 📄 License
|
|
213
|
+
|
|
214
|
+
Distribuido bajo la Licencia **MIT**. Consulta [`LICENSE`](LICENSE) para más detalles.
|
aecode-0.2.0/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# ⚡ AeCode
|
|
4
|
+
|
|
5
|
+
### The Ultra-Compressed DSL for Web Scraping & UI Generation.
|
|
6
|
+
**Save up to 95% of LLM Tokens. Reduce latency by 10x.**
|
|
7
|
+
|
|
8
|
+
[](https://pypi.org/project/aecode/)
|
|
9
|
+
[](https://pypi.org/project/aecode/)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://pypi.org/project/aecode/)
|
|
12
|
+
[](https://github.com/aecode-lang/aecode/actions)
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="#-the-problem-llm-token-inflation">Why AeCode?</a> •
|
|
16
|
+
<a href="#-quick-start">Quick Start</a> •
|
|
17
|
+
<a href="#-syntax-reference">Syntax</a> •
|
|
18
|
+
<a href="#-benchmarks">Benchmarks</a> •
|
|
19
|
+
<a href="#-examples">Examples</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🤯 The Problem: LLM Token Inflation
|
|
27
|
+
|
|
28
|
+
Current AI Coding Agents (Claude 3.5, GPT-4o, Gemini Pro) spend **90% of their output tokens** writing:
|
|
29
|
+
- Hundreds of lines of repetitive `import requests`, `BeautifulSoup` boilerplate.
|
|
30
|
+
- Tedious HTML boilerplate, `<!DOCTYPE html>`, Tailwind classes strings, and nested loop syntax.
|
|
31
|
+
- Verbose CSS selector traversals and error-handling blocks.
|
|
32
|
+
|
|
33
|
+
**The result?** Higher API bills, sluggish response times, context window exhaustion, and higher chances of hallucinated syntax.
|
|
34
|
+
|
|
35
|
+
### 💡 The Solution: AeCode
|
|
36
|
+
|
|
37
|
+
**AeCode** compresses complex web workflows into high-density mathematical & functional primitives. An AI model writes **10 lines** of AeCode; the engine compiles and executes it as **200+ lines** of production Python + Tailwind CSS.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 🥊 Real Code Comparison
|
|
42
|
+
|
|
43
|
+
### Task: Scrape 20 Products and Render a Live Dashboard
|
|
44
|
+
|
|
45
|
+
#### ❌ The Python + HTML Traditional Way (285 Tokens)
|
|
46
|
+
```python
|
|
47
|
+
import csv, requests
|
|
48
|
+
from bs4 import BeautifulSoup
|
|
49
|
+
|
|
50
|
+
resp = requests.get("http://books.toscrape.com")
|
|
51
|
+
soup = BeautifulSoup(resp.text, 'html.parser')
|
|
52
|
+
books = []
|
|
53
|
+
for pod in soup.select(".product_pod"):
|
|
54
|
+
t = pod.select_one("h3 > a")["title"]
|
|
55
|
+
p = pod.select_one(".price_color").text
|
|
56
|
+
books.append({"title": t, "price": p})
|
|
57
|
+
|
|
58
|
+
html = """<!DOCTYPE html><html><head><script src="https://cdn.tailwindcss.com"></script></head><body class="bg-gray-900 text-white p-8"><div class="grid grid-cols-4 gap-6">"""
|
|
59
|
+
for b in books:
|
|
60
|
+
html += f"""<div class="bg-gray-800 p-4 rounded-xl border border-gray-700"><h3 class="font-bold">{b['title']}</h3><p class="text-amber-400 font-bold">{b['price']}</p></div>"""
|
|
61
|
+
html += "</div></body></html>"
|
|
62
|
+
with open("view.html", "w") as f: f.write(html)
|
|
63
|
+
import webbrowser; webbrowser.open("view.html")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### ✅ The AeCode Way (32 Tokens — 89% Ahorro)
|
|
67
|
+
```text
|
|
68
|
+
DATA = SCRAPE("http://books.toscrape.com", ".product_pod", [title: "h3 > a" @ "title", price: ".price_color" @ "text"])
|
|
69
|
+
VIEW = GRID 4 > CARD(title, price) FROM DATA
|
|
70
|
+
RENDER VIEW
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 📊 Benchmarks
|
|
76
|
+
|
|
77
|
+
| Task | Traditional Python | AeCode | Token Savings |
|
|
78
|
+
|:---|:---:|:---:|:---:|
|
|
79
|
+
| Basic Web Scraping | ~180 tokens | **48 tokens** | **-73%** |
|
|
80
|
+
| Multithreaded Parallel FlatMap | ~280 tokens | **60 tokens** | **-78%** |
|
|
81
|
+
| Auto-Pagination (Crawl) | ~320 tokens | **52 tokens** | **-84%** |
|
|
82
|
+
| Tailwind Landing Page | ~500 tokens | **25 tokens** | **-95%** |
|
|
83
|
+
| Live Scrape-to-UI Dashboard | ~600 tokens | **35 tokens** | **-94%** |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## ⚡ Quick Start
|
|
88
|
+
|
|
89
|
+
### 1. Installation
|
|
90
|
+
```bash
|
|
91
|
+
pip install aecode
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 2. Verify Your System
|
|
95
|
+
```bash
|
|
96
|
+
aecode doctor
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 3. Run Your First Flow
|
|
100
|
+
```bash
|
|
101
|
+
aecode flow examples/dashboard.ae
|
|
102
|
+
```
|
|
103
|
+
*Voilà! It automatically scrapes live data, builds an interactive Tailwind CSS UI, and opens it directly in your default browser.*
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 🧭 Three Engines in One DSL
|
|
108
|
+
|
|
109
|
+
### 1. 🌐 AeWeb (Scraping & Data Extraction)
|
|
110
|
+
```text
|
|
111
|
+
doc = GET("http://books.toscrape.com")
|
|
112
|
+
items = doc > ".product_pod"
|
|
113
|
+
rows = items | λi. {title: (i > "h3 > a") @ "title", price: (i > ".price_color") @ "text"}
|
|
114
|
+
rows => "libros.csv"
|
|
115
|
+
```
|
|
116
|
+
```bash
|
|
117
|
+
aecode scrape examples/scraper.ae
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 2. 🎨 AeUI (Declarative Web Layouts)
|
|
121
|
+
```text
|
|
122
|
+
PAGE /home
|
|
123
|
+
NAV [MiMarca, Links(Productos, Precios, Contacto)]
|
|
124
|
+
HERO "Bienvenido al futuro" center
|
|
125
|
+
GRID 3 > CARD(title, desc, price)
|
|
126
|
+
BTN "Empezar ahora"
|
|
127
|
+
FOOTER
|
|
128
|
+
```
|
|
129
|
+
```bash
|
|
130
|
+
aecode build examples/landing.ae --output index.html
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 3. ⚡ AeFlow (End-to-End Scraping to Web App)
|
|
134
|
+
```text
|
|
135
|
+
DATA = SCRAPE("http://books.toscrape.com", ".product_pod", [title: "h3 > a" @ "title", price: ".price_color" @ "text"])
|
|
136
|
+
VIEW = GRID 4 > CARD(title, price) FROM DATA
|
|
137
|
+
RENDER VIEW
|
|
138
|
+
```
|
|
139
|
+
```bash
|
|
140
|
+
aecode flow examples/dashboard.ae
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 📐 Syntax Reference
|
|
146
|
+
|
|
147
|
+
| Operator / Primitiva | Descripción | Ejemplo |
|
|
148
|
+
|:---|:---|:---|
|
|
149
|
+
| `GET(url)` | Petición HTTP + Parseo HTML | `doc = GET("https://...")` |
|
|
150
|
+
| `>` | Selector CSS | `items = doc > ".product_pod"` |
|
|
151
|
+
| `@` | Extracción de atributo o texto | `(el > "a") @ "href"` o `@ "text"` |
|
|
152
|
+
| `\|` | Map funcional sobre colecciones | `items \| λi. { ... }` |
|
|
153
|
+
| `\|?` | Filtro funcional booleano | `items \|? λi. num(i @ "text") > 50` |
|
|
154
|
+
| `\|*` | FlatMap concurrente multihilo | `urls \|* λu. (GET(u) > ".pod")` |
|
|
155
|
+
| `CRAWL(url, fn, max)` | Auto-paginación secuencial segura | `CRAWL(url, λd. d > "li.next > a" @ "href", 5)` |
|
|
156
|
+
| `SCRAPE(...)` | Extracción masiva estructurada | `SCRAPE(url, selector, [fields])` |
|
|
157
|
+
| `GRID n > CARD(...)` | Cuadrícula responsiva Tailwind | `GRID 4 > CARD(title, price)` |
|
|
158
|
+
| `RENDER view` | Compilación y apertura web | `RENDER VIEW` |
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 🧠 Philosophy: Mathematical Brevity > Verbosity
|
|
163
|
+
|
|
164
|
+
Programming languages designed in the 1990s were made for human keyboards. In 2026, code is generated by AI agents collaborating with humans.
|
|
165
|
+
|
|
166
|
+
- **Tokens are compute.**
|
|
167
|
+
- **Tokens are latency.**
|
|
168
|
+
- **Tokens are cost.**
|
|
169
|
+
|
|
170
|
+
AeCode treats code like mathematical equations: dense, declarative, composable, and crystal clear.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 📈 Star History
|
|
175
|
+
|
|
176
|
+
[](https://star-history.com/#aecode-lang/aecode&Date)
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 🤝 Community & Support
|
|
181
|
+
|
|
182
|
+
- 🌟 Star the repository on [GitHub](https://github.com/aecode-lang/aecode)
|
|
183
|
+
- 💬 Discuss on [HackerNews](https://news.ycombinator.com) and [Reddit (r/Python)](https://reddit.com/r/Python)
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 📄 License
|
|
188
|
+
|
|
189
|
+
Distribuido bajo la Licencia **MIT**. Consulta [`LICENSE`](LICENSE) para más detalles.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""AeCode - DSL ultra-compacto para scraping, UI y APIs."""
|
|
2
|
+
__version__ = "0.2.0"
|
|
3
|
+
|
|
4
|
+
from .web_engine import ae_get, ae_select, ae_attr, ae_crawl, scrape
|
|
5
|
+
from .ui_engine import build_ui, build_and_open
|
|
6
|
+
from .flow_engine import run_flow
|
|
7
|
+
from .api_engine import ae_api_get, ae_api_post, ae_api_graphql, run_api
|