binary-equalab 2.0.1__tar.gz → 3.0.0b1__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.
@@ -1,16 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: binary-equalab
3
- Version: 2.0.1
4
- Summary: Advanced Algebra & Calculus CLI Tool
5
- Project-URL: Homepage, https://github.com/Malexnnn/BinaryEquaLab
6
- Project-URL: Repository, https://github.com/Malexnnn/BinaryEquaLab
7
- Project-URL: Documentation, https://github.com/Malexnnn/BinaryEquaLab#readme
8
- Author-email: Malexnnn <carde@example.com>
9
- License-Expression: MIT
10
- Keywords: algebra,calculator,calculus,cas,math,spanish,symbolic
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: Environment :: Console
13
- Classifier: Intended Audience :: Education
3
+ Version: 3.0.0b1
4
+ Summary: Binary Equalab is a symbolic mathematics toolkit focused on clarity, performance and educational value. Designed for students, engineers and curious minds who want math to feel alive.
5
+ Project-URL: Homepage, https://github.com/AldrasTeam/BinaryEquaLab
6
+ Project-URL: Repository, https://github.com/AldrasTeam/BinaryEquaLab
7
+ Project-URL: Documentation, https://github.com/AldrasTeam/BinaryEquaLab#readme
8
+ Author-email: Aldra <manhalev1520@gmail.com>, Aldra's Team <manhalev1520@gmail.com>
9
+ Maintainer-email: "Aldra (José Avilés)" <manhalev1520@gmail.com>
10
+ License: MIT
11
+ Keywords: aldra,cas,cli,education,engineering,math,scientific-computing,symbolic-math
14
12
  Classifier: Intended Audience :: Science/Research
15
13
  Classifier: License :: OSI Approved :: MIT License
16
14
  Classifier: Operating System :: OS Independent
@@ -21,10 +19,14 @@ Classifier: Programming Language :: Python :: 3.11
21
19
  Classifier: Programming Language :: Python :: 3.12
22
20
  Classifier: Topic :: Scientific/Engineering :: Mathematics
23
21
  Requires-Python: >=3.9
24
- Requires-Dist: numpy>=1.24
25
- Requires-Dist: prompt-toolkit>=3.0
26
- Requires-Dist: rich>=13.0
22
+ Requires-Dist: matplotlib>=3.7.0
23
+ Requires-Dist: numpy>=1.24.0
24
+ Requires-Dist: prompt-toolkit>=3.0.0
25
+ Requires-Dist: requests>=2.31.0
26
+ Requires-Dist: rich>=13.0.0
27
+ Requires-Dist: scipy>=1.10.0
27
28
  Requires-Dist: sympy>=1.12
29
+ Requires-Dist: typer>=0.9.0
28
30
  Provides-Extra: dev
29
31
  Requires-Dist: black>=23.0; extra == 'dev'
30
32
  Requires-Dist: mypy>=1.0; extra == 'dev'
@@ -186,4 +188,4 @@ pytest
186
188
 
187
189
  ---
188
190
 
189
- MIT © Malexnnn/ Aldra ORG.
191
+ MIT © Aldra's Team
@@ -152,4 +152,4 @@ pytest
152
152
 
153
153
  ---
154
154
 
155
- MIT © Malexnnn/ Aldra ORG.
155
+ MIT © Aldra's Team
@@ -99,7 +99,7 @@ def get_prompt_style():
99
99
  def print_banner():
100
100
  """Print the CLI banner using Rich panels."""
101
101
  title = Text("Binary EquaLab CLI", style="bold white")
102
- version = Text("Aurora v2.0.0", style="dim")
102
+ version = Text("Aurora v2.0.2", style="dim")
103
103
  slogan = Text('"Las matemáticas también sienten,\npero estas no se equivocan."', style="dim italic")
104
104
 
105
105
  content = Text.assemble(title, " ", version, "\n\n", slogan, justify="center")
@@ -153,15 +153,20 @@ def repl():
153
153
  console.print(f"[dim]{i}.[/dim] {h}")
154
154
  continue
155
155
 
156
- # --- Easter Eggs ---
157
- if cmd == 'binary':
158
- console.print(Panel("[bold cyan]Las matemáticas también sienten.[/bold cyan]", border_style="cyan"))
156
+ # --- Easter Eggs (Math Based) ---
157
+ # 1+1 -> 2
158
+ if user_input.replace(" ", "") == "1+1":
159
+ console.print(Panel("[bold cyan]2[/bold cyan]\n[dim italic]El principio de todo.[/dim italic]", border_style="cyan"))
159
160
  continue
160
- if cmd == 'aldra':
161
- console.print(Panel("[bold magenta]De Aldra para la gente, gratis y con alma.[/bold magenta]", border_style="magenta"))
161
+
162
+ # (-1)*(-1) -> 1
163
+ if user_input.replace(" ", "") in ["(-1)*(-1)", "-1*-1"]:
164
+ console.print(Panel("[bold green]1[/bold green]\n[dim italic]Menos por menos es más... como en la vida.[/dim italic]", border_style="green"))
162
165
  continue
163
- if cmd == 'lupe':
164
- console.print(Panel("[bold white]In Memoriam.[/bold white]", border_style="white"))
166
+
167
+ # The Answer
168
+ if user_input.replace(" ", "") == "0b101010":
169
+ console.print(Panel("[bold magenta]42[/bold magenta]\n[dim italic]La respuesta a todo.[/dim italic]", border_style="magenta"))
165
170
  continue
166
171
  # -------------------
167
172
 
@@ -214,6 +219,66 @@ def main():
214
219
  if len(sys.argv) > 1 and sys.argv[1] == 'setup-shell':
215
220
  from .shell_setup import run_setup
216
221
  run_setup()
222
+ elif len(sys.argv) > 1 and sys.argv[1] == 'ai':
223
+ # AI Commands Mode
224
+ from .kimi_service import kimi_service
225
+
226
+ if len(sys.argv) < 3:
227
+ console.print("[bold red]Uso:[/bold red] binary ai [solve|explain|exercises] \"consulta\"")
228
+ sys.exit(1)
229
+
230
+ subcmd = sys.argv[2]
231
+ query = " ".join(sys.argv[3:])
232
+
233
+ # 'exercises' command doesn't necessarily need a query if defaults are used, but we'll use query as topic
234
+ if subcmd != 'exercises' and not query:
235
+ console.print("[bold red]Error:[/bold red] Falta la consulta.")
236
+ sys.exit(1)
237
+
238
+ with console.status(f"[bold green]Kimi AI ({subcmd})...[/bold green]"):
239
+ if subcmd == "solve":
240
+ result = kimi_service.solve_math_problem(query)
241
+ if isinstance(result, dict):
242
+ console.print(Panel(
243
+ f"[bold]Solución:[/bold]\n{result.get('solution', '')}\n\n"
244
+ f"[bold]Dificultad:[/bold] {result.get('difficulty', '')}\n"
245
+ f"[bold]Conceptos:[/bold] {', '.join(result.get('concepts', []))}",
246
+ title="Kimi AI: Resolución", border_style="green"
247
+ ))
248
+ if result.get('steps'):
249
+ console.print("\n[bold]Pasos:[/bold]")
250
+ for step in result['steps']:
251
+ console.print(f"• {step}")
252
+ console.print(f"\n[dim italic]{result.get('reasoning', '')}[/dim italic]")
253
+ else:
254
+ console.print(result)
255
+
256
+ elif subcmd == "explain":
257
+ response = kimi_service.explain_concept(query)
258
+ console.print(Panel(Markdown(response), title=f"Kimi AI: Explicación", border_style="blue"))
259
+
260
+ elif subcmd == "exercises":
261
+ # Uso: binary ai exercises "Derivadas" [opcional: count]
262
+ # Por simplicidad en sys.argv, asumimos que todo el resto es el topic
263
+ exercises = kimi_service.generate_exercises(query if query else "Matemáticas generales")
264
+
265
+ console.print(f"[bold u]Generando ejercicios para:[/bold u] {query}\n")
266
+
267
+ for i, ex in enumerate(exercises, 1):
268
+ console.print(Panel(
269
+ f"[bold]Pregunta:[/bold]\n{ex.get('problem')}\n\n"
270
+ f"[bold]Solución:[/bold]\n{ex.get('solution')}",
271
+ title=f"Ejercicio {i}", border_style="magenta"
272
+ ))
273
+ if ex.get('steps'):
274
+ with console.status(f"[dim]Ver pasos...[/dim]"):
275
+ # Hack para ocultar pasos inicialmente si se quisiera, pero aquí los mostramos
276
+ pass
277
+ console.print(f"[dim]Pasos: {', '.join(ex.get('steps', []))}[/dim]\n")
278
+ else:
279
+ console.print(f"[bold red]Comando desconocido:[/bold red] {subcmd}")
280
+ sys.exit(1)
281
+
217
282
  elif len(sys.argv) > 1 and sys.argv[1] == 'feedback':
218
283
  import webbrowser
219
284
  print("""
@@ -226,10 +291,10 @@ def main():
226
291
  Estoy abierto a cualquier sugerencia, apoyo, financiamiento,
227
292
  compañía, o reporte de errores.
228
293
 
229
- 🐛 Bugs / Mejoras: https://github.com/Malexnnn/BinaryEqualab/issues
230
- 📧 Contacto: Ver perfil de GitHub
294
+ 🐛 Bugs / Mejoras: https://github.com/AldrasTeam/BinaryEquaLab/issues
295
+ 📧 Contacto: contact@aldra.dev
231
296
  """)
232
- webbrowser.open("https://github.com/Malexnnn/BinaryEqualab")
297
+ webbrowser.open("https://github.com/AldrasTeam/BinaryEquaLab")
233
298
 
234
299
  elif len(sys.argv) > 1:
235
300
  # One-liner mode
@@ -0,0 +1,137 @@
1
+
2
+ import os
3
+ import json
4
+ import requests
5
+ from typing import List, Dict, Optional, Generator
6
+ from rich.console import Console
7
+
8
+ console = Console()
9
+
10
+ class KimiService:
11
+ """Service to interact with Kimi K2 (Moonshot AI) via Direct API"""
12
+
13
+ def __init__(self):
14
+ # Priority: Env Var > .env File > Config File
15
+ self.api_key = os.getenv('KIMI_API_KEY')
16
+
17
+ # Manually load .env if not found in environment
18
+ if not self.api_key:
19
+ try:
20
+ env_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), '.env')
21
+ if os.path.exists(env_path):
22
+ with open(env_path, 'r', encoding='utf-8') as f:
23
+ for line in f:
24
+ if line.strip().startswith('KIMI_API_KEY='):
25
+ self.api_key = line.strip().split('=', 1)[1].strip('"\'')
26
+ os.environ['KIMI_API_KEY'] = self.api_key
27
+ break
28
+ except Exception as e:
29
+ console.print(f"[yellow]Warning: Could not load .env file: {e}[/yellow]")
30
+
31
+ self.base_url = 'https://api.moonshot.cn/v1'
32
+ self.model = 'moonshot-v1-128k' # Using 128k model as K2 proxy
33
+
34
+ def set_api_key(self, key: str):
35
+ self.api_key = key
36
+ # In a real app, save this to a config file
37
+ os.environ['KIMI_API_KEY'] = key
38
+
39
+ def _get_headers(self):
40
+ if not self.api_key:
41
+ raise ValueError("KIMI_API_KEY not configured. Run 'export KIMI_API_KEY=sk-...'")
42
+ return {
43
+ 'Content-Type': 'application/json',
44
+ 'Authorization': f'Bearer {self.api_key}'
45
+ }
46
+
47
+ def chat(self, messages: List[Dict[str, str]], temperature: float = 0.7) -> str:
48
+ """Send message to Kimi"""
49
+ try:
50
+ payload = {
51
+ 'model': self.model,
52
+ 'messages': messages,
53
+ 'temperature': temperature,
54
+ }
55
+ response = requests.post(f'{self.base_url}/chat/completions', headers=self._get_headers(), json=payload)
56
+ response.raise_for_status()
57
+ return response.json()['choices'][0]['message']['content']
58
+ except Exception as e:
59
+ return f"Error connecting to Kimi AI: {str(e)}"
60
+
61
+ def solve_math_problem(self, problem: str, show_steps: bool = True) -> Dict[str, any]:
62
+ """
63
+ Resolver problema matemático con razonamiento paso a paso.
64
+ Retorna un diccionario estructurado.
65
+ """
66
+ system_prompt = f"""Eres un asistente matemático experto de Aldra's Team (Binary EquaLab AI).
67
+
68
+ Resuelve el siguiente problema {'mostrando TODOS los pasos' if show_steps else 'directamente'}.
69
+
70
+ Responde ESTRICTAMENTE en formato JSON con esta estructura:
71
+ {{
72
+ "solution": "Respuesta final matemática (LaTeX/texto)",
73
+ "steps": ["Paso 1: ...", "Paso 2: ..."],
74
+ "reasoning": "Explicación breve del enfoque",
75
+ "difficulty": "fácil|medio|difícil",
76
+ "concepts": ["Concepto 1", "Concepto 2"]
77
+ }}"""
78
+
79
+ messages = [
80
+ {'role': 'system', 'content': system_prompt},
81
+ {'role': 'user', 'content': problem}
82
+ ]
83
+
84
+ response_text = self.chat(messages, temperature=0.3)
85
+ try:
86
+ # Limpiar markdown si el modelo lo incluye (e.g. ```json ... ```)
87
+ cleaned = response_text.replace('```json', '').replace('```', '').strip()
88
+ return json.loads(cleaned)
89
+ except json.JSONDecodeError:
90
+ return {
91
+ "solution": response_text,
92
+ "steps": ["No se pudo parsear la respuesta estructurada."],
93
+ "reasoning": "Respuesta directa del modelo.",
94
+ "difficulty": "desconocido",
95
+ "concepts": []
96
+ }
97
+
98
+ def explain_concept(self, concept: str, level: str = 'intermedio') -> str:
99
+ """Explicación pedagógica de conceptos"""
100
+ system_prompt = f"""Eres un profesor de matemáticas apasionado de Aldra's Team.
101
+ Explica el concepto solicitado para un nivel {level}.
102
+ Usa analogías, claridad y rigor."""
103
+
104
+ messages = [
105
+ {'role': 'system', 'content': system_prompt},
106
+ {'role': 'user', 'content': f"Explícame: {concept}"}
107
+ ]
108
+ return self.chat(messages, temperature=0.5)
109
+
110
+ def generate_exercises(self, topic: str, count: int = 5, difficulty: str = 'medio') -> List[Dict[str, any]]:
111
+ """Generar ejercicios de práctica"""
112
+ system_prompt = f"""Genera {count} ejercicios de {topic} con dificultad {difficulty}.
113
+
114
+ Responde ESTRICTAMENTE en formato JSON (Array de objetos):
115
+ [
116
+ {{
117
+ "problem": "Enunciado",
118
+ "solution": "Respuesta",
119
+ "steps": ["Paso 1", "Paso 2"],
120
+ "concepts": ["Concepto A"]
121
+ }}
122
+ ]"""
123
+
124
+ messages = [
125
+ {'role': 'system', 'content': system_prompt},
126
+ {'role': 'user', 'content': "Genera los ejercicios."}
127
+ ]
128
+
129
+ response_text = self.chat(messages, temperature=0.7)
130
+ try:
131
+ cleaned = response_text.replace('```json', '').replace('```', '').strip()
132
+ return json.loads(cleaned)
133
+ except json.JSONDecodeError:
134
+ return []
135
+
136
+ # Singleton
137
+ kimi_service = KimiService()
@@ -0,0 +1,70 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "binary-equalab"
7
+ version = "3.0.0b1"
8
+ description = "Binary Equalab is a symbolic mathematics toolkit focused on clarity, performance and educational value. Designed for students, engineers and curious minds who want math to feel alive."
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "Aldra", email = "manhalev1520@gmail.com"},
13
+ {name = "Aldra's Team", email = "manhalev1520@gmail.com"},
14
+ ]
15
+ maintainers = [
16
+ {name = "Aldra (José Avilés)", email = "manhalev1520@gmail.com"}
17
+ ]
18
+ keywords = [
19
+ "symbolic-math",
20
+ "cas",
21
+ "engineering",
22
+ "cli",
23
+ "education",
24
+ "scientific-computing",
25
+ "math",
26
+ "aldra"
27
+ ]
28
+ classifiers = [
29
+ "Intended Audience :: Science/Research",
30
+ "License :: OSI Approved :: MIT License",
31
+ "Operating System :: OS Independent",
32
+ "Programming Language :: Python :: 3",
33
+ "Programming Language :: Python :: 3.9",
34
+ "Programming Language :: Python :: 3.10",
35
+ "Programming Language :: Python :: 3.11",
36
+ "Programming Language :: Python :: 3.12",
37
+ "Topic :: Scientific/Engineering :: Mathematics",
38
+ ]
39
+ requires-python = ">=3.9"
40
+ dependencies = [
41
+ "typer>=0.9.0",
42
+ "rich>=13.0.0",
43
+ "prompt_toolkit>=3.0.0",
44
+ "sympy>=1.12",
45
+ "numpy>=1.24.0",
46
+ "matplotlib>=3.7.0",
47
+ "scipy>=1.10.0",
48
+ "requests>=2.31.0"
49
+ ]
50
+
51
+ [project.optional-dependencies]
52
+ dev = [
53
+ "pytest>=7.0",
54
+ "pytest-cov>=4.0",
55
+ "black>=23.0",
56
+ "mypy>=1.0",
57
+ ]
58
+
59
+ [project.scripts]
60
+ binary-math = "binary_equalab.cli:main"
61
+ beq = "binary_equalab.cli:main"
62
+ bneqls = "binary_equalab.cli:main"
63
+
64
+ [project.urls]
65
+ Homepage = "https://github.com/AldrasTeam/BinaryEquaLab"
66
+ Repository = "https://github.com/AldrasTeam/BinaryEquaLab"
67
+ Documentation = "https://github.com/AldrasTeam/BinaryEquaLab#readme"
68
+
69
+ [tool.hatch.build.targets.wheel]
70
+ packages = ["binary_equalab"]
@@ -1,33 +0,0 @@
1
- # Script de Publicacion a PyPI para Binary EquaLab
2
- # Autor: Malexnnn
3
- # NOTA: Sin emojis para evitar problemas de codificacion en Windows
4
-
5
- Write-Host "[INFO] Iniciando proceso de publicacion para Binary EquaLab CLI..." -ForegroundColor Cyan
6
-
7
- # 1. Instalar herramientas
8
- Write-Host "[WAIT] Verificando herramientas (build, twine)..." -ForegroundColor Yellow
9
- pip install --upgrade build twine
10
-
11
- # 2. Limpiar
12
- if (Test-Path "dist") {
13
- Write-Host "[WAIT] Limpiando carpeta dist..." -ForegroundColor Yellow
14
- Remove-Item "dist" -Recurse -Force
15
- }
16
-
17
- # 3. Construir
18
- Write-Host "[WAIT] Construyendo paquete (sdist + wheel)..." -ForegroundColor Yellow
19
- python -m build
20
-
21
- # 4. Validar
22
- if (-not (Test-Path "dist")) {
23
- Write-Host "[ERROR] Fallo la construccion." -ForegroundColor Red
24
- exit 1
25
- }
26
-
27
- # 5. Subir
28
- Write-Host "[INFO] Subiendo a PyPI..." -ForegroundColor Yellow
29
- Write-Host "NOTA: Usa tu token de PyPI (__token__) como usuario." -ForegroundColor Gray
30
- python -m twine upload dist/*
31
-
32
- Write-Host "[DONE] Proceso finalizado." -ForegroundColor Green
33
- write-Host "Instalar con: pip install binary-equalab" -ForegroundColor Cyan
@@ -1,56 +0,0 @@
1
- [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
4
-
5
- [project]
6
- name = "binary-equalab"
7
- version = "2.0.1"
8
- description = "Advanced Algebra & Calculus CLI Tool"
9
- readme = "README.md"
10
- license = "MIT"
11
- authors = [
12
- { name = "Malexnnn", email = "carde@example.com" }
13
- ]
14
- keywords = ["calculator", "cas", "math", "symbolic", "spanish", "algebra", "calculus"]
15
- classifiers = [
16
- "Development Status :: 4 - Beta",
17
- "Environment :: Console",
18
- "Intended Audience :: Education",
19
- "Intended Audience :: Science/Research",
20
- "License :: OSI Approved :: MIT License",
21
- "Operating System :: OS Independent",
22
- "Programming Language :: Python :: 3",
23
- "Programming Language :: Python :: 3.9",
24
- "Programming Language :: Python :: 3.10",
25
- "Programming Language :: Python :: 3.11",
26
- "Programming Language :: Python :: 3.12",
27
- "Topic :: Scientific/Engineering :: Mathematics",
28
- ]
29
- requires-python = ">=3.9"
30
- dependencies = [
31
- "sympy>=1.12",
32
- "numpy>=1.24",
33
- "rich>=13.0",
34
- "prompt_toolkit>=3.0",
35
- ]
36
-
37
- [project.optional-dependencies]
38
- dev = [
39
- "pytest>=7.0",
40
- "pytest-cov>=4.0",
41
- "black>=23.0",
42
- "mypy>=1.0",
43
- ]
44
-
45
- [project.scripts]
46
- binary-math = "binary_equalab.cli:main"
47
- beq = "binary_equalab.cli:main"
48
- bneqls = "binary_equalab.cli:main"
49
-
50
- [project.urls]
51
- Homepage = "https://github.com/Malexnnn/BinaryEquaLab"
52
- Repository = "https://github.com/Malexnnn/BinaryEquaLab"
53
- Documentation = "https://github.com/Malexnnn/BinaryEquaLab#readme"
54
-
55
- [tool.hatch.build.targets.wheel]
56
- packages = ["binary_equalab"]