jjsonr 0.1.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.
jjsonr-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: jjsonr
3
+ Version: 0.1.0
4
+ Summary: Convierte matrices a JSON fácilmente
5
+ Author: Tu Nombre
6
+ Requires-Python: >=3.8
jjsonr-0.1.0/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # jjsonr
2
+
3
+ Convierte matrices a JSON de forma simple, rápida y sin dependencias pesadas.
4
+
5
+ ---
6
+
7
+ ## Características
8
+
9
+ * Convierte matrices a JSON
10
+ * Soporta encabezados automáticamente
11
+ * Salida formateada
12
+ * CLI incluida
13
+ * Ligero y fácil de usar
14
+
15
+ ---
16
+
17
+ ## 📦 Instalación
18
+
19
+ ```bash
20
+ pip install jjsonr
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Uso en Python
26
+
27
+ ```python
28
+ from jjsonr import convertir
29
+
30
+ matriz = [
31
+ ["nombre", "edad"],
32
+ ["Juan", 25],
33
+ ["Ana", 30]
34
+ ]
35
+
36
+ resultado = convertir(matriz, usar_header=True)
37
+
38
+ print(resultado)
39
+ ```
40
+
41
+ ### 🔥 Output
42
+
43
+ ```json
44
+ [
45
+ {
46
+ "nombre": "Juan",
47
+ "edad": 25
48
+ },
49
+ {
50
+ "nombre": "Ana",
51
+ "edad": 30
52
+ }
53
+ ]
54
+ ```
55
+
56
+ ## Ejemplo sin encabezados
57
+
58
+ ```python
59
+ from jjsonr import convertir
60
+
61
+ matriz = [
62
+ ["Juan", 25],
63
+ ["Ana", 30]
64
+ ]
65
+
66
+ print(convertir(matriz))
67
+ ```
68
+
69
+ ### Output:
70
+
71
+ ```json
72
+ [
73
+ {
74
+ "0": "Juan",
75
+ "1": 25
76
+ },
77
+ {
78
+ "0": "Ana",
79
+ "1": 30
80
+ }
81
+ ]
82
+ ```
83
+
84
+ ---
85
+
86
+ ## 🚀 Roadmap (próximas features)
87
+
88
+ * [ ] Exportar a archivo (`--output`)
89
+ * [ ] Soporte para CSV
90
+ * [ ] Detección automática de tipos
91
+ * [ ] Mejor manejo de errores
92
+
93
+ ---
94
+
95
+ ## 👨‍💻 Autor
96
+
97
+ Creado por Junior Barrera (Jr)
98
+
99
+ ---
100
+
101
+ ## 📄 Licencia
102
+
103
+ MIT
@@ -0,0 +1 @@
1
+ from .core import convertir
@@ -0,0 +1,17 @@
1
+ import argparse
2
+ import json
3
+ from .core import convertir
4
+
5
+ def main():
6
+ parser = argparse.ArgumentParser()
7
+ parser.add_argument("archivo")
8
+ parser.add_argument("--header", action="store_true")
9
+
10
+ args = parser.parse_args()
11
+
12
+ with open(args.archivo) as f:
13
+ matriz = json.load(f)
14
+
15
+ print(convertir(matriz, usar_header=args.header))
16
+ if __name__ == "__main__":
17
+ main()
@@ -0,0 +1,22 @@
1
+ import json
2
+ from .validators import validar_matriz
3
+
4
+ def convertir(matriz, columnas=None, usar_header=False, pretty=True):
5
+ validar_matriz(matriz)
6
+
7
+ if usar_header:
8
+ columnas = matriz[0]
9
+ matriz = matriz[1:]
10
+
11
+ if columnas:
12
+ data = [dict(zip(columnas, fila)) for fila in matriz]
13
+ else:
14
+ data = [
15
+ {str(i): valor for i, valor in enumerate(fila)}
16
+ for fila in matriz
17
+ ]
18
+
19
+ if pretty:
20
+ return json.dumps(data, indent=2, ensure_ascii=False)
21
+
22
+ return json.dumps(data)
@@ -0,0 +1,12 @@
1
+ def validar_matriz(matriz):
2
+ if not isinstance(matriz, list) or not matriz:
3
+ raise ValueError("La matriz debe ser una lista no vacía")
4
+
5
+ longitud = len(matriz[0])
6
+
7
+ for fila in matriz:
8
+ if not isinstance(fila, list):
9
+ raise ValueError("Cada fila debe ser una lista")
10
+
11
+ if len(fila) != longitud:
12
+ raise ValueError("Todas las filas deben tener la misma longitud")
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: jjsonr
3
+ Version: 0.1.0
4
+ Summary: Convierte matrices a JSON fácilmente
5
+ Author: Tu Nombre
6
+ Requires-Python: >=3.8
@@ -0,0 +1,11 @@
1
+ README.md
2
+ pyproject.toml
3
+ jjsonr/__init__.py
4
+ jjsonr/cli.py
5
+ jjsonr/core.py
6
+ jjsonr/validators.py
7
+ jjsonr.egg-info/PKG-INFO
8
+ jjsonr.egg-info/SOURCES.txt
9
+ jjsonr.egg-info/dependency_links.txt
10
+ jjsonr.egg-info/entry_points.txt
11
+ jjsonr.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ jjsonr = jjsonr.cli:main
@@ -0,0 +1 @@
1
+ jjsonr
@@ -0,0 +1,13 @@
1
+ [project]
2
+ name = "jjsonr"
3
+ version = "0.1.0"
4
+ description = "Convierte matrices a JSON fácilmente"
5
+ authors = [{ name = "Tu Nombre" }]
6
+ requires-python = ">=3.8"
7
+
8
+ [project.scripts]
9
+ jjsonr = "jjsonr.cli:main"
10
+
11
+ [build-system]
12
+ requires = ["setuptools", "wheel"]
13
+ build-backend = "setuptools.build_meta"
jjsonr-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+