<commit_before>[![Build Status](https://travis-ci.org/okfn/datapackage-registry-py.svg)](https://travis-ci.org/okfn/datapackage-registry-py)
[![Coverage Status](https://coveralls.io/repos/okfn/datapackage-registry-py/badge.svg?branch=master&service=github)](https://coveralls.io/github/okfn/datapackage-registry-py?branch=master)

datapackage-registry-py
=======================

A Python library for working with a Data Package Registry.

The default registry backend is currently located at:
<https://rawgit.com/dataprotocols/registry/master/registry.csv>

Usage
-----

```python
import datapackage_registry

# get the default registry objects
registry = datapackage_registry.Registry()

# see the available profiles in the registry
print(registry.available_profiles)
# {
#     'base': {
#         'id': 'base',
#         'schema': 'https://rawgit.com/dataprotocols/schemas/master/data-package.json',
#         'specification': 'http://dataprotocols.org/data-packages',
#         'title': 'Data Package'
#     },
#     'tabular': {
#         'id': 'tabular',
#         'schema': 'https://rawgit.com/dataprotocols/schemas/master/tabular-data-package.json',
#         'specification': 'http://dataprotocols.org/tabular-data-package/',
#         'title': 'Tabular Data Package'
#    }
# }

# get a profile by its id
base_profile = registry.get('base')
```

If you’d like to use a custom registry, you can pass its URL or local
path to the `Registry()` constructor, as in:

```python
import datapackage_registry

registry = datapackage_registry.Registry('http://someplace.com/my-registry.csv')
```

Developer notes
---------------

These notes are intended to help people that want to contribute to this
package itself. If you just want to use it, you can safely ignore this.

### Upgrading the local schemas cache

We cache the schemas from <https://github.com/dataprotocols/schemas>
using git-subtree. To update it, use:

    git subtree pull --prefix datapackage_registry/schemas https://github.com/dataprotocols/schemas.git master --squash<commit_msg>Rename "Upgrading" -> "Updating" the cache<commit_after>[![Build Status](https://travis-ci.org/okfn/datapackage-registry-py.svg)](https://travis-ci.org/okfn/datapackage-registry-py)
[![Coverage Status](https://coveralls.io/repos/okfn/datapackage-registry-py/badge.svg?branch=master&service=github)](https://coveralls.io/github/okfn/datapackage-registry-py?branch=master)

datapackage-registry-py
=======================

A Python library for working with a Data Package Registry.

The default registry backend is currently located at:
<https://rawgit.com/dataprotocols/registry/master/registry.csv>

Usage
-----

```python
import datapackage_registry

# get the default registry objects
registry = datapackage_registry.Registry()

# see the available profiles in the registry
print(registry.available_profiles)
# {
#     'base': {
#         'id': 'base',
#         'schema': 'https://rawgit.com/dataprotocols/schemas/master/data-package.json',
#         'specification': 'http://dataprotocols.org/data-packages',
#         'title': 'Data Package'
#     },
#     'tabular': {
#         'id': 'tabular',
#         'schema': 'https://rawgit.com/dataprotocols/schemas/master/tabular-data-package.json',
#         'specification': 'http://dataprotocols.org/tabular-data-package/',
#         'title': 'Tabular Data Package'
#    }
# }

# get a profile by its id
base_profile = registry.get('base')
```

If you’d like to use a custom registry, you can pass its URL or local
path to the `Registry()` constructor, as in:

```python
import datapackage_registry

registry = datapackage_registry.Registry('http://someplace.com/my-registry.csv')
```

Developer notes
---------------

These notes are intended to help people that want to contribute to this
package itself. If you just want to use it, you can safely ignore this.

### Updating the local schemas cache

We cache the schemas from <https://github.com/dataprotocols/schemas>
using git-subtree. To update it, use:

    git subtree pull --prefix datapackage_registry/schemas https://github.com/dataprotocols/schemas.git master --squash
{'fraction_non_alphanumeric': 0.15191098209966133, 'fraction_numerical': 0.0, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1284467', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1254, 'n_words': 309}