pypoldata 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.
@@ -0,0 +1,222 @@
1
+ .DS_Store
2
+ notebook/
3
+
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[codz]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py.cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # pyenv
90
+ # For a library or package, you might want to ignore these files since the code is
91
+ # intended to run in multiple environments; otherwise, check them in:
92
+ # .python-version
93
+
94
+ # pipenv
95
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
97
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
98
+ # install all needed dependencies.
99
+ # Pipfile.lock
100
+
101
+ # UV
102
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
103
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
104
+ # commonly ignored for libraries.
105
+ # uv.lock
106
+
107
+ # poetry
108
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
109
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
110
+ # commonly ignored for libraries.
111
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
112
+ # poetry.lock
113
+ # poetry.toml
114
+
115
+ # pdm
116
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
117
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
118
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
119
+ # pdm.lock
120
+ # pdm.toml
121
+ .pdm-python
122
+ .pdm-build/
123
+
124
+ # pixi
125
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
126
+ # pixi.lock
127
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
128
+ # in the .venv directory. It is recommended not to include this directory in version control.
129
+ .pixi
130
+
131
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
132
+ __pypackages__/
133
+
134
+ # Celery stuff
135
+ celerybeat-schedule
136
+ celerybeat.pid
137
+
138
+ # Redis
139
+ *.rdb
140
+ *.aof
141
+ *.pid
142
+
143
+ # RabbitMQ
144
+ mnesia/
145
+ rabbitmq/
146
+ rabbitmq-data/
147
+
148
+ # ActiveMQ
149
+ activemq-data/
150
+
151
+ # SageMath parsed files
152
+ *.sage.py
153
+
154
+ # Environments
155
+ .env
156
+ .envrc
157
+ .venv
158
+ env/
159
+ venv/
160
+ ENV/
161
+ env.bak/
162
+ venv.bak/
163
+
164
+ # Spyder project settings
165
+ .spyderproject
166
+ .spyproject
167
+
168
+ # Rope project settings
169
+ .ropeproject
170
+
171
+ # mkdocs documentation
172
+ /site
173
+
174
+ # mypy
175
+ .mypy_cache/
176
+ .dmypy.json
177
+ dmypy.json
178
+
179
+ # Pyre type checker
180
+ .pyre/
181
+
182
+ # pytype static type analyzer
183
+ .pytype/
184
+
185
+ # Cython debug symbols
186
+ cython_debug/
187
+
188
+ # PyCharm
189
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
190
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
191
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
192
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
193
+ # .idea/
194
+
195
+ # Abstra
196
+ # Abstra is an AI-powered process automation framework.
197
+ # Ignore directories containing user credentials, local state, and settings.
198
+ # Learn more at https://abstra.io/docs
199
+ .abstra/
200
+
201
+ # Visual Studio Code
202
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
203
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
204
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
205
+ # you could uncomment the following to ignore the entire vscode folder
206
+ # .vscode/
207
+ # Temporary file for partial code execution
208
+ tempCodeRunnerFile.py
209
+
210
+ # Ruff stuff:
211
+ .ruff_cache/
212
+
213
+ # PyPI configuration file
214
+ .pypirc
215
+
216
+ # Marimo
217
+ marimo/_static/
218
+ marimo/_lsp/
219
+ __marimo__/
220
+
221
+ # Streamlit
222
+ .streamlit/secrets.toml
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alejandro Henao Ruiz
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,122 @@
1
+ Metadata-Version: 2.5
2
+ Name: pypoldata
3
+ Version: 0.1.0
4
+ Summary: Acceso reproducible a datasets abiertos para Ciencia Política y Ciencias Sociales.
5
+ Project-URL: Homepage, https://github.com/ahenaor/pypoldata
6
+ Project-URL: Repository, https://github.com/ahenaor/pypoldata
7
+ Project-URL: Issues, https://github.com/ahenaor/pypoldata/issues
8
+ Author: Alejandro Henao Ruiz
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Requires-Python: >=3.10
12
+ Requires-Dist: geopandas>=1.0
13
+ Requires-Dist: pandas>=2.0
14
+ Requires-Dist: platformdirs>=4.0
15
+ Requires-Dist: pyarrow>=12.0
16
+ Requires-Dist: requests>=2.31
17
+ Description-Content-Type: text/markdown
18
+
19
+ # PyPolData
20
+
21
+ [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
22
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
23
+ [![Status: MVP](https://img.shields.io/badge/Status-Alpha%20%2F%20MVP-orange.svg)]()
24
+
25
+ > **Acceso reproducible y transparente a datasets abiertos para Ciencia Política y Ciencias Sociales.**
26
+
27
+ PyPolData es una biblioteca en Python diseñada para reducir la fricción técnica y metodológica que enfrentan estudiantes e investigadores al localizar, descargar, procesar, documentar y citar datos politológicos y territoriales.
28
+
29
+ ---
30
+
31
+ ## 🎯 ¿Por qué PyPolData?
32
+
33
+ El análisis de datos en ciencias políticas suele enfrentarse a barreras innecesarias:
34
+ * Datasets dispersos en formatos pesados e ineficientes (e.g. GeoJSONs de +200 MB, CSVs sin tipado).
35
+ * Pérdida de trazabilidad y procedencia de los archivos.
36
+ * Dificultades para asegurar la reproducibilidad exacta en aulas y publicaciones académicas.
37
+
38
+ PyPolData resuelve esto combinando **formatos analíticos modernos (Parquet / GeoParquet)**, **distribución versionada en GitHub Releases**, **validación criptográfica de integridad (SHA-256)** y **caché local transparente**.
39
+
40
+ ---
41
+
42
+ ## 🚀 Instalación
43
+
44
+ ```bash
45
+ # Clonar el repositorio
46
+ git clone https://github.com/ahenaor/pypoldata.git
47
+ cd pypoldata
48
+
49
+ # Instalar en modo desarrollo / editable
50
+ pip install -e .
51
+ ```
52
+
53
+ *Próximamente disponible vía PyPI:*
54
+ ```bash
55
+ pip install pypoldata
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 💡 Uso Rápido
61
+
62
+ ### 1. Listar datasets disponibles en el catálogo
63
+ ```python
64
+ import pypoldata as ppd
65
+
66
+ # Explorar los datasets indexados
67
+ ppd.list_datasets()
68
+ ```
69
+
70
+ ### 2. Cargar un dataset analítico
71
+ Carga datos directamente a memoria (`pandas.DataFrame` o `geopandas.GeoDataFrame`). La primera llamada descarga el artefacto optimizado a tu caché local verificando su huella SHA-256; las siguientes llamadas son instantáneas y funcionan sin conexión.
72
+
73
+ ```python
74
+ import pypoldata as ppd
75
+
76
+ # Cargar cartografía municipal de Colombia optimizada en GeoParquet
77
+ gdf = ppd.load("colombia_municipios")
78
+
79
+ # Visualizar
80
+ gdf.plot(color="#e0f3f8", edgecolor="#1b7837", linewidth=0.5)
81
+ ```
82
+
83
+ ---
84
+
85
+ ## 📦 Datasets Disponibles en el MVP
86
+
87
+ | `dataset_id` | Descripción | Nivel / Unidad | Formato | Fuente |
88
+ | :--- | :--- | :--- | :--- | :--- |
89
+ | `colombia_municipios` | Cartografía vectorial de los 1.122 municipios de Colombia (simplificada y optimizada). | Municipio | GeoParquet (~3.5 MB) | DANE / IGAC |
90
+
91
+ ---
92
+
93
+ ## ⚙️ Arquitectura y Principios de Diseño
94
+
95
+ 1. **Separación entre Código y Datos:** La versión del paquete (`v0.1.0`), las versiones de los datasets (`1.0.0`) y las etiquetas de release de datos (`data-v2026.08`) se gestionan de manera independiente.
96
+ 2. **Integridad por Defecto:** Todo archivo descargado es validado contra su hash **SHA-256** registrado en el catálogo central. Si el archivo sufre alteraciones o descargas truncadas, se rechaza de forma atómica.
97
+ 3. **Caché Inteligente:** Los archivos se almacenan localmente respetando los estándares del sistema operativo (vía `platformdirs` o la variable de entorno `PYPOLDATA_DATA_HOME`).
98
+ 4. **Eficiencia Analítica:** Estandarización sobre **Parquet / GeoParquet** con compresión nativa, preservando tipos de datos y reduciendo el consumo de ancho de banda hasta en un 98%.
99
+
100
+ ---
101
+
102
+ ## 🛠️ Estructura del Repositorio
103
+
104
+ ```text
105
+ pypoldata/
106
+ ├── src/
107
+ │ └── pypoldata/
108
+ │ ├── __init__.py # Exportación de la API pública (load, list_datasets)
109
+ │ ├── core.py # Motor de caché, descarga atómica y validación SHA-256
110
+ │ └── catalog.json # Manifiesto central con metadatos y hashes de datasets
111
+ ├── notebook/
112
+ │ └── dev.ipynb # Notebooks de prueba y exploración
113
+ ├── pyproject.toml # Configuración del paquete y dependencias
114
+ ├── README.md
115
+ └── LICENSE
116
+ ```
117
+
118
+ ---
119
+
120
+ ## 📄 Licencia
121
+
122
+ Este proyecto está bajo la Licencia **MIT**. Cada dataset distribuido mediante PyPolData conserva y documenta su propia licencia de origen (generalmente Creative Commons o datos abiertos gubernamentales).
@@ -0,0 +1,104 @@
1
+ # PyPolData
2
+
3
+ [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5
+ [![Status: MVP](https://img.shields.io/badge/Status-Alpha%20%2F%20MVP-orange.svg)]()
6
+
7
+ > **Acceso reproducible y transparente a datasets abiertos para Ciencia Política y Ciencias Sociales.**
8
+
9
+ PyPolData es una biblioteca en Python diseñada para reducir la fricción técnica y metodológica que enfrentan estudiantes e investigadores al localizar, descargar, procesar, documentar y citar datos politológicos y territoriales.
10
+
11
+ ---
12
+
13
+ ## 🎯 ¿Por qué PyPolData?
14
+
15
+ El análisis de datos en ciencias políticas suele enfrentarse a barreras innecesarias:
16
+ * Datasets dispersos en formatos pesados e ineficientes (e.g. GeoJSONs de +200 MB, CSVs sin tipado).
17
+ * Pérdida de trazabilidad y procedencia de los archivos.
18
+ * Dificultades para asegurar la reproducibilidad exacta en aulas y publicaciones académicas.
19
+
20
+ PyPolData resuelve esto combinando **formatos analíticos modernos (Parquet / GeoParquet)**, **distribución versionada en GitHub Releases**, **validación criptográfica de integridad (SHA-256)** y **caché local transparente**.
21
+
22
+ ---
23
+
24
+ ## 🚀 Instalación
25
+
26
+ ```bash
27
+ # Clonar el repositorio
28
+ git clone https://github.com/ahenaor/pypoldata.git
29
+ cd pypoldata
30
+
31
+ # Instalar en modo desarrollo / editable
32
+ pip install -e .
33
+ ```
34
+
35
+ *Próximamente disponible vía PyPI:*
36
+ ```bash
37
+ pip install pypoldata
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 💡 Uso Rápido
43
+
44
+ ### 1. Listar datasets disponibles en el catálogo
45
+ ```python
46
+ import pypoldata as ppd
47
+
48
+ # Explorar los datasets indexados
49
+ ppd.list_datasets()
50
+ ```
51
+
52
+ ### 2. Cargar un dataset analítico
53
+ Carga datos directamente a memoria (`pandas.DataFrame` o `geopandas.GeoDataFrame`). La primera llamada descarga el artefacto optimizado a tu caché local verificando su huella SHA-256; las siguientes llamadas son instantáneas y funcionan sin conexión.
54
+
55
+ ```python
56
+ import pypoldata as ppd
57
+
58
+ # Cargar cartografía municipal de Colombia optimizada en GeoParquet
59
+ gdf = ppd.load("colombia_municipios")
60
+
61
+ # Visualizar
62
+ gdf.plot(color="#e0f3f8", edgecolor="#1b7837", linewidth=0.5)
63
+ ```
64
+
65
+ ---
66
+
67
+ ## 📦 Datasets Disponibles en el MVP
68
+
69
+ | `dataset_id` | Descripción | Nivel / Unidad | Formato | Fuente |
70
+ | :--- | :--- | :--- | :--- | :--- |
71
+ | `colombia_municipios` | Cartografía vectorial de los 1.122 municipios de Colombia (simplificada y optimizada). | Municipio | GeoParquet (~3.5 MB) | DANE / IGAC |
72
+
73
+ ---
74
+
75
+ ## ⚙️ Arquitectura y Principios de Diseño
76
+
77
+ 1. **Separación entre Código y Datos:** La versión del paquete (`v0.1.0`), las versiones de los datasets (`1.0.0`) y las etiquetas de release de datos (`data-v2026.08`) se gestionan de manera independiente.
78
+ 2. **Integridad por Defecto:** Todo archivo descargado es validado contra su hash **SHA-256** registrado en el catálogo central. Si el archivo sufre alteraciones o descargas truncadas, se rechaza de forma atómica.
79
+ 3. **Caché Inteligente:** Los archivos se almacenan localmente respetando los estándares del sistema operativo (vía `platformdirs` o la variable de entorno `PYPOLDATA_DATA_HOME`).
80
+ 4. **Eficiencia Analítica:** Estandarización sobre **Parquet / GeoParquet** con compresión nativa, preservando tipos de datos y reduciendo el consumo de ancho de banda hasta en un 98%.
81
+
82
+ ---
83
+
84
+ ## 🛠️ Estructura del Repositorio
85
+
86
+ ```text
87
+ pypoldata/
88
+ ├── src/
89
+ │ └── pypoldata/
90
+ │ ├── __init__.py # Exportación de la API pública (load, list_datasets)
91
+ │ ├── core.py # Motor de caché, descarga atómica y validación SHA-256
92
+ │ └── catalog.json # Manifiesto central con metadatos y hashes de datasets
93
+ ├── notebook/
94
+ │ └── dev.ipynb # Notebooks de prueba y exploración
95
+ ├── pyproject.toml # Configuración del paquete y dependencias
96
+ ├── README.md
97
+ └── LICENSE
98
+ ```
99
+
100
+ ---
101
+
102
+ ## 📄 Licencia
103
+
104
+ Este proyecto está bajo la Licencia **MIT**. Cada dataset distribuido mediante PyPolData conserva y documenta su propia licencia de origen (generalmente Creative Commons o datos abiertos gubernamentales).
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pypoldata"
7
+ version = "0.1.0"
8
+ description = "Acceso reproducible a datasets abiertos para Ciencia Política y Ciencias Sociales."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [
12
+ { name = "Alejandro Henao Ruiz" }
13
+ ]
14
+ requires-python = ">=3.10"
15
+ dependencies = [
16
+ "pandas>=2.0",
17
+ "geopandas>=1.0",
18
+ "pyarrow>=12.0",
19
+ "requests>=2.31",
20
+ "platformdirs>=4.0"
21
+ ]
22
+
23
+ [project.urls]
24
+ Homepage = "https://github.com/ahenaor/pypoldata"
25
+ Repository = "https://github.com/ahenaor/pypoldata"
26
+ Issues = "https://github.com/ahenaor/pypoldata/issues"
27
+
28
+ # Obligatorio para empaquetar catalog.json junto con el código
29
+ [tool.hatch.build.targets.wheel]
30
+ packages = ["src/pypoldata"]
31
+
32
+ [tool.hatch.build.targets.sdist]
33
+ include = [
34
+ "/src/pypoldata/catalog.json",
35
+ ]
@@ -0,0 +1,31 @@
1
+ {
2
+ "catalog_version": "0.1.0",
3
+ "datasets": {
4
+ "colombia_municipios": {
5
+ "title": "Límites Municipales de Colombia",
6
+ "description": "Cartografía vectorial de los municipios de Colombia.",
7
+ "latest_version": "1.0.0",
8
+ "versions": {
9
+ "1.0.0": {
10
+ "data_release": "data-v2026.08",
11
+ "artifacts": {
12
+ "data": {
13
+ "asset_name": "colombia_municipios.parquet",
14
+ "format": "geoparquet",
15
+ "sha256": "1a7d3a2150b5c38f03faf28561f3565a9bfb5894701b159e082eca9b2b6cfd83"
16
+ }
17
+ },
18
+ "source": {
19
+ "name": "DANE / IGAC",
20
+ "url": "https://geoportal.dane.gov.co",
21
+ "accessed_at": "2026-08-18"
22
+ },
23
+ "license": "CC-BY-4.0",
24
+ "unit_of_analysis": "municipio",
25
+ "geography": "Colombia",
26
+ "time_coverage": "2022"
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }