Package: ckanext-datasetversions
This CKAN extension adds support for different versions of a dataset. Sometimes
is is desirable to store and display together different versions of a dataset,
for example a daily situation report-style map during a humanitarian crisis.This plugin provides an actiondataset_version_create, for example:toolkit.get_action('dataset_version_create')(
    context, {
        'id': dataset['id'],
        'base_name': base_name,
        'owner_org': owner_org
    }
)The plugin models dataset versions internally by creating a parent dataset, with
minimal metadata and no resources. A child dataset is created for each version.dataset_version_createwill create a parent-child relationship between the
dataset specified bybase_nameand that specified byid. If the dataset
specified bybase_namedoes not exist, it will be created.Note that this plugin overrides CKAN’spackage_showaction. The originalpackage_showis made available asckan_package_show.For datasets with different versions, the overriddenpackage_showwill
return:The latest, public, active version of the dataset if the parent name or id is specifiedA specific version of the dataset if the child name or id is specifiedThe version ordering is determined by the integer value ofversionin the
dataset metadata.In addition,package_showwill return a list of the names and URLs of all
active versions as_versionsin the dictionary.The plugin provides templates to list versions of a dataset alongside that
currently viewed and to warn the user if they are looking at an old version of a
dataset.RequirementsThis plugin will not work ‘out of the box’. You will need to write code to call
thedataset_version_createaction. A site-specific example is available athttps://github.com/aptivate/ckanext-mapactionimporterThis is known to work with CKAN 2.5.2, though note there are problems when
purging datasets with relationships. See:https://github.com/ckan/ckan/pull/3112https://github.com/ckan/ckan/issues/2186InstallationTo install ckanext-datasetversions:Activate your CKAN virtual environment, for example:. /usr/lib/ckan/default/bin/activateInstall the ckanext-datasetversions Python package into your virtual environment:pip install ckanext-datasetversionsAdddatasetversionsto theckan.pluginssetting 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 reloadConfig SettingsNoneDevelopment InstallationTo install ckanext-datasetversions for development, activate your CKAN virtualenv and
do:git clone https://github.com/aptivate/ckanext-datasetversions.git
cd ckanext-datasetversions
python setup.py develop
pip install -r dev-requirements.txtRunning the TestsTo run the tests, do:nosetests --nologcapture --with-pylons=test.iniTo 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.datasetversions --cover-inclusive --cover-erase --cover-testsRegistering ckanext-datasetversions on PyPIckanext-datasetversions should be availabe on PyPI ashttps://pypi.python.org/pypi/ckanext-datasetversions. 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 sdistRegister the project:python setup.py registerUpload the source distribution to PyPI:python setup.py sdist uploadTag the first release of the project on GitHub with the version number from
thesetup.pyfile. For example if the version number insetup.pyis
0.0.1 then do:git tag 0.0.1
git push --tagsReleasing a New Version of ckanext-datasetversionsckanext-datasetversions is availabe on PyPI ashttps://pypi.python.org/pypi/ckanext-datasetversions.
To publish a new version to PyPI follow these steps:Update the version number in thesetup.pyfile.
SeePEP 440for how to choose version numbers.Create a source distribution of the new version:python setup.py sdistUpload the source distribution to PyPI:python setup.py sdist uploadTag the new release of the project on GitHub with the version number from
thesetup.pyfile. For example if the version number insetup.pyis
0.0.2 then do:git tag 0.0.2
git push --tags