Allows syndication (pushing) of datasets to another repository
Project description
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
Tested with CKAN 2.5.2
Requires celery
To work over SSL, requires pyOpenSSL, ndg-httpsclient and pyasn1
It may be useful to run Celery in a production environment through supervisor
Installation
To install ckanext-syndicate:
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
Install the ckanext-syndicate Python package into your virtual environment:
pip install ckanext-syndicate
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).
Restart CKAN. For example if you’ve deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
You will also need to set up celery. In a development environment this can be done with the following paster command from within your virtual environment:
paster --plugin=ckan celeryd run -c /etc/ckan/default/development.ini
In a production environment, celery can be configured through supervisor, for example /etc/supervisor/conf.d/celery.conf:
[program:celery] autorestart=true autostart=true command=/usr/lib/ckan/default/bin/paster --plugin=ckan celeryd --config=/etc/ckan/default/production.ini numprocs=1 priority=998 redirect_stderr=true startsecs=10 stderr_logfile=/var/log/celeryd.log stdout_logfile=/var/log/celeryd.log stopwaitsecs=600 user=www-data
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
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-hypernode.com/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:
Create a source distribution of the project:
python setup.py sdist
Register the project:
python setup.py register
Upload the source distribution to PyPI:
python setup.py sdist upload
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-hypernode.com/pypi/ckanext-syndicate. To publish a new version to PyPI follow these steps:
Update the version number in the setup.py file. See PEP 440 for how to choose version numbers.
Create a source distribution of the new version:
python setup.py sdist
Upload the source distribution to PyPI:
python setup.py sdist upload
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ckanext-syndicate-1.0.1.tar.gz
.
File metadata
- Download URL: ckanext-syndicate-1.0.1.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | efb84c6c377dabff853b92f342a49553b9e9387b8b9f0af4f670ca5839736f49 |
|
MD5 | 1d94eb9c0c453a93f96a355958100a39 |
|
BLAKE2b-256 | 35c290463dc1f5da93e880194f7d1065c377ebdb3c6078450d41a45a70de9d6b |