GithubHelp home page GithubHelp logo

otevrenamesta / ckanext-syndicate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aptivate/ckanext-syndicate

0.0 6.0 0.0 67 KB

A CKAN plugin that allows syndication (pushing) of datasets to another ckan repository

License: GNU Affero General Public License v3.0

Shell 4.05% Python 95.95%

ckanext-syndicate's Introduction

ckanext-syndicate

CKAN plugin to syndicate datasets to another CKAN instance.

This plugin provides a mechanism to syndicate datasets to another instance of CKAN. If a dataset has the syndicate flag set to True in its custom metadata, any updates to the dataset will be reflected in the syndicated version. Resources in the syndicated dataset are stored as the URLs of the resources in the original. You must have the API key of a user on the target instance of CKAN. See the Config Settings section below.

Plugins can modify data sent for syndication by implementing the action update_dataset_for_syndication and modifying the dataset_dict value. This is useful if the schemas are different between CKAN instances.

Requirements

  • To work over SSL, requires requests, pyOpenSSL, ndg-httpsclient and pyasn1

Installation

To install ckanext-syndicate:

  1. Activate your CKAN virtual environment, for example:

    . /usr/lib/ckan/default/bin/activate
    
  2. Install the ckanext-syndicate Python package into your virtual environment:

    pip install ckanext-syndicate
    
  3. Add syndicate to the ckan.plugins setting in your CKAN config file (by default the config file is located at /etc/ckan/default/production.ini).

  4. Restart CKAN. For example if you've deployed CKAN with Apache:

    sudo service apache2 reload
    
  5. You will also need to set up RQ job runner, to test it you can run:

    paster jobs worker default

Config Settings

# The URL of the site to be syndicated to
ckan.syndicate.ckan_url = https://data.humdata.org/

# The API key of the user on the syndicated site
ckan.syndicate.api_key = 9efdd954-c643-444a-97a1-c9c374cef861

# The custom metadata flag used for syndication
# (optional, default: syndicate).
ckan.syndicate.flag = syndicate_to_hdx

# The custom metadata field to store the syndicated dataset ID
# on the original dataset
# (optional, default: syndicated_id)
ckan.syndicate.id = hdx_id

# A prefix to apply to the name of the syndicated dataset
# (optional, default: )
ckan.syndicate.name_prefix = my-prefix

# The name of the organization on the target CKAN to use when creating
# the syndicated datasets
# (optional, default: None)
ckan.syndicate.organization = my-org-name

# The user agent
# (optional, default: constructed from ckanapi version and url)
ckan.syndicate.user_agent = My User Agent

# Try to preserve dataset's organization
# (optional, default: false)
ckan.syndicate.replicate_organization = boolean

# The username whose api_key is used.
# If the dataset already exists on the target CKAN instance, the dataset will be updated
# only if this option is set and its creator matches this user name
# (optional, default: None)
ckan.syndicate.author = some_user_name

Development Installation

To install ckanext-syndicate for development, activate your CKAN virtualenv and do:

git clone https://github.com/aptivate/ckanext-syndicate.git
cd ckanext-syndicate
python setup.py develop
pip install -r dev-requirements.txt

See also Installation

Running the Tests

To run the tests, do:

nosetests --nologcapture --with-pylons=test.ini

To run the tests and produce a coverage report, first make sure you have coverage installed in your virtualenv (pip install coverage) then run:

nosetests --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.syndicate --cover-inclusive --cover-erase --cover-tests

Registering ckanext-syndicate on PyPI

ckanext-syndicate should be availabe on PyPI as https://pypi.python.org/pypi/ckanext-syndicate. If that link doesn't work, then you can register the project on PyPI for the first time by following these steps:

  1. Create a source distribution of the project:

    python setup.py sdist
    
  2. Register the project:

    python setup.py register
    
  3. Upload the source distribution to PyPI:

    python setup.py sdist upload
    
  4. Tag the first release of the project on GitHub with the version number from the setup.py file. For example if the version number in setup.py is 0.0.1 then do:

    git tag 0.0.1
    git push --tags
    

Releasing a New Version of ckanext-syndicate

ckanext-syndicate is availabe on PyPI as https://pypi.python.org/pypi/ckanext-syndicate. To publish a new version to PyPI follow these steps:

  1. Update the version number in the setup.py file. See PEP 440 for how to choose version numbers.

  2. Create a source distribution of the new version:

    python setup.py sdist
    
  3. Upload the source distribution to PyPI:

    python setup.py sdist upload
    
  4. Tag the new release of the project on GitHub with the version number from the setup.py file. For example if the version number in setup.py is 0.0.2 then do:

    git tag 0.0.2
    git push --tags
    

ckanext-syndicate's People

Contributors

martinburchell avatar sorki avatar smotornyuk avatar alanmjackson avatar

Watchers

 avatar Šimon Berka avatar James Cloos avatar Ladislav Nesnera avatar Jakub Michálek avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.