Skip to content

Commit

Permalink
updateo documetnacion
Browse files Browse the repository at this point in the history
  • Loading branch information
capitantoto committed Nov 25, 2016
2 parents 4c70204 + f4deabf commit 34da110
Show file tree
Hide file tree
Showing 14 changed files with 143 additions and 74 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ python:
- '2.7'
script:
- nosetests --with-coverage --cover-package=pydatajson
# - make docs
# - travis-sphinx --source=docs -n build
sudo: false

8 changes: 4 additions & 4 deletions HISTORY.md
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
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ pydatajson
[![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://data-cleaner.readthedocs.org/en/latest/?badge=latest)
[![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`:
Expand Down
7 changes: 7 additions & 0 deletions docs/HISTORY.md
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
95 changes: 95 additions & 0 deletions docs/README.md
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/).
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
# version is used.
sys.path.insert(0, project_root)

import sphinx_rtd_theme
import pydatajson

# -- General configuration ---------------------------------------------
Expand Down Expand Up @@ -116,7 +117,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a
# theme further. For a list of options available for each theme, see the
Expand Down
1 change: 0 additions & 1 deletion docs/contributing.rst

This file was deleted.

9 changes: 2 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
Welcome to pydatajson's documentation!
Bienvenido a la documentación de pydatajson!
======================================

Contents:

.. toctree::
:maxdepth: 2

README.md
installation
usage
contributing
HISTORY.md

Indices and tables
Indices y tablas
==================

* :ref:`genindex`
Expand Down
51 changes: 0 additions & 51 deletions docs/installation.rst

This file was deleted.

7 changes: 7 additions & 0 deletions docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pydatajson
==========

.. toctree::
:maxdepth: 4

pydatajson
22 changes: 22 additions & 0 deletions docs/pydatajson.rst
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:
7 changes: 0 additions & 7 deletions docs/usage.rst

This file was deleted.

1 change: 1 addition & 0 deletions pydatajson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

__author__ = """Datos Argentina"""
__email__ = 'datos@modernizacion.gob.ar'
__version__ = '0.0.12'
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ PyYAML==3.11
nose
recommonmark
twine
sphinx_rtd_theme

0 comments on commit 34da110

Please sign in to comment.