-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
143 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
History | ||
=== | ||
|
||
0.0.12 (2016-11-25) | ||
0.0.13 (2016-11-25) | ||
------------------ | ||
|
||
* Lograr que la instalación del paquete sepa dónde están los schemas default. | ||
* Intentar que la instalación del paquete sepa donde están instalados los schemas por default | ||
|
||
0.0.1 (2016-11-21) | ||
0.0.12 (2016-11-25) | ||
------------------ | ||
|
||
* First release on PyPI. | ||
* Primera versión propuesta para v0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
History | ||
=== | ||
|
||
0.0.12 (2016-11-25) | ||
------------------ | ||
|
||
* Primera versión propuesta para v0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
pydatajson | ||
=== | ||
|
||
[![Coverage Status](https://coveralls.io/repos/github/datosgobar/pydatajson/badge.svg?branch=master)](https://coveralls.io/github/datosgobar/pydatajson?branch=master) | ||
[![Build Status](https://travis-ci.org/datosgobar/pydatajson.svg?branch=master)](https://travis-ci.org/datosgobar/pydatajson) | ||
[![PyPI](https://badge.fury.io/py/pydatajson.svg)](http://badge.fury.io/py/pydatajson) | ||
[![Stories in Ready](https://badge.waffle.io/datosgobar/pydatajson.png?label=ready&title=Ready)](https://waffle.io/datosgobar/pydatajson) | ||
[![Documentation Status](http://readthedocs.org/projects/pydatajson/badge/?version=latest)](http://pydatajson.readthedocs.io/en/latest/?badge=latest) | ||
|
||
Paquete en python con herramientas para manipular y validar metadatos de catálogos de datos en formato data.json. | ||
|
||
* Licencia: MIT license | ||
* Documentación: https://pydatajson.readthedocs.io. | ||
|
||
## Instalación | ||
|
||
Instalar la librería debería ser tan sencillo como un `pip install`: | ||
|
||
* **Producción:** Desde cualquier parte | ||
|
||
```bash | ||
$ pip install pydatajson | ||
``` | ||
|
||
* **Desarrollo:** Clonar este repositorio, y desde su raíz, ejecutar: | ||
```bash | ||
$ pip install -e . | ||
``` | ||
|
||
## Uso | ||
|
||
La librería implementa un objeto, `DataJson`, con varios métodos para verificar la integridad de los archivos `data.json` y manipular su contenido. De particular interés son `is_valid_catalog` y `validate_catalog`. | ||
|
||
### Validar la estructura de un data.json contra el esquema por default que incluye la librería | ||
|
||
#### Archivo data.json local | ||
|
||
DataJson es capaz de validar archivos locales en cualquier directorio (accesible) siempre y cuando se provea el path absoluto a él. | ||
Por conveniencia, la carpeta [`tests/samples/`](tests/samples/) contiene varios ejemplos de `data.json`s bien y mal formados con distintos tipos de errores. | ||
|
||
```python | ||
from pydatajson import DataJson | ||
|
||
dj = DataJson() | ||
datajson_path = "tests/samples/full_data.json" | ||
validation_result = dj.is_valid_catalog(datajson_path) | ||
validation_report = dj.validate_catalog(datajson_path) | ||
|
||
print validation_result | ||
True | ||
|
||
print validation_report | ||
{ | ||
"status": "OK", | ||
"error": { | ||
"catalog": [], | ||
"dataset": [] | ||
} | ||
} | ||
``` | ||
|
||
#### Archivo data.json remoto | ||
|
||
También es posible proveer una URL remota al archivo `data.json` de un portal productivo. Internamente, DataJson entiende que si el path del archivo a validar comienza con "http", se trata de una URL remota. | ||
|
||
```python | ||
datajson_url = "http://104.131.35.253/data.json" | ||
validation_result = dj.is_valid_catalog(datajson_url) | ||
validation_report = dj.validate_catalog(datajson_url) | ||
|
||
print validation_result | ||
False | ||
|
||
print validation_report | ||
{ | ||
"status": "ERROR", | ||
"error": { | ||
"catalog": ["Título del portal"], | ||
"dataset": ["Dataset ejemplo 04", "Dataset ejemplo 03", | ||
"Dataset ejemplo 02", "Dataset ejemplo 01"] | ||
} | ||
} | ||
``` | ||
|
||
## Tests | ||
|
||
Los tests de la librería se desarrollaron con `nose`. Para correrlos, desde la raíz del repositorio: | ||
``` | ||
$ pip install nose # Sólo la primera vez | ||
$ nosetests | ||
``` | ||
|
||
## Créditos | ||
|
||
El validador de archivos `data.json` desarrollado no es más que un conveniente envoltorio alrededor de la librería [`jsonschema`](https://github.com/Julian/jsonschema), que implementa el estándar definido por [JSONSchema.org](http://json-schema.org/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pydatajson | ||
========== | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
pydatajson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
pydatajson package | ||
================== | ||
|
||
Submodules | ||
---------- | ||
|
||
pydatajson.pydatajson module | ||
---------------------------- | ||
|
||
.. automodule:: pydatajson.pydatajson | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: pydatajson | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
|
||
__author__ = """Datos Argentina""" | ||
__email__ = 'datos@modernizacion.gob.ar' | ||
__version__ = '0.0.12' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ PyYAML==3.11 | |
nose | ||
recommonmark | ||
twine | ||
sphinx_rtd_theme |