{ "info": { "author": "Open Knowledge International", "author_email": "info@okfn.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", "Programming Language :: Python :: 2.7" ], "description": "[![Build Status](https://travis-ci.org/ckan/ckanext-datapackager.png)](https://travis-ci.org/ckan/ckanext-datapackager) [![Coverage Status](https://coveralls.io/repos/ckan/ckanext-datapackager/badge.png?branch=master)](https://coveralls.io/r/ckan/ckanext-datapackager?branch=master)\n\n# CKAN Data Packager\n\nThis extension adds importing and exporting of [Data Packages][data-packages] to [CKAN][ckan] datasets.\n\n## Requirements\n\n* CKAN >= 2.4\n* Python 2.7\n\n## Installing\n\nTo install `ckanext-datapackager` into a CKAN instance, do:\n\n1. If you're using a virtual environment for CKAN, activate it doing, for example:\n\n source /usr/lib/ckan/default/bin/activate\n\n2. Install the `ckanext-datapackager` extension using pip:\n\n pip install ckanext-datapackager\n\n Alternatively do a development install (with your virtualenv activated):\n\n git clone https://github.com/ckan/ckanext-datapackager.git\n cd ckanext-datapackager\n python setup.py develop\n pip install -r requirements.txt\n\n\n3. Add `datapackager` to the `ckan.plugins` setting in your CKAN config file;\n4. Restart CKAN.\n\n## Using\n\n### Web Interface\n\n#### Importing\n\n![Importing Data Package](doc/images/ckanext-datapackager-import-demo.gif)\n\n1. Visit the Dataset list page (e.g. `http://your-ckan-address.com/dataset`)\n2. Click on `Import Data Package` button;\n3. Upload or link to a Data Package JSON or ZIP file;\n * Depending on your CKAN configuration, you might also need to define\n the dataset's organization and visibility here.\n4. Review the created dataset.\n\n#### Exporting\n\n![Exporting CKAN Dataset as Data Package](doc/images/ckanext-datapackager-export-link.png)\n\n1. Go to the dataset's page;\n2. Click on `Download Data Package` button.\n\n### API\n\n\nThe extension provides two API actions for importing (`package_create_from_datapackage`) and exporting (`package_show_as_datapackage`) Data Packages on CKAN.\n\nFor more information on their parameters and return values, check the\ndocstrings inside the files at\n[ckanext/datapackager/logic/action](ckanext/datapackager/logic/action).\n\n\n\n\n\n#### Importing\n\nIf the Data Package (either the `datapackage.json` file or a zip file with the `datapackage.json` and the data files) is reachable through an URL, you can do a request to `package_create_from_datapackage` as such:\n\n```\ncurl -X POST \\\n -H 'Authorization: YOUR_CKAN_API_KEY' \\\n -d '{\"url\": \"https://link.to/datapackage.json\"}' \\\n http://CKAN_HOST/api/action/package_create_from_datapackage\n```\n\nYou can also use [ckanapi][ckanapi]:\n\n ckanapi action package_create_from_datapackage url=URL_TO_DATAPACKAGE owner_org=OWNER_ORGANIZATION_ID -r http://CKAN_HOST\n\nFor uploading the Data Package, check the documentation on uploading files using [ckanapi](https://github.com/ckan/ckanapi#file-uploads) or check this example using [requests](http://docs.python-requests.org/en/latest/):\n\n```python\nimport requests\n\nr = requests.post('http://CKAN_HOST/api/action/package_create_from_datapackage',\n headers={'Authorization': YOUR_CKAN_API_KEY},\n files=[('upload', file('/path/to/datapackage.json/or/file.zip'))])\n\n\n```\n\n#### Exporting\n\nFor exporting a dataset as a `datapackage.json` just call `package_show_as_datapackage` with the relevant dataset id:\n\n curl 'http://CKAN_HOST/api/action/package_show_as_datapackage?id=940a5fe0-0c72-41c4-8a28-8c794f399036'\n\n {\"help\": \"http://CKAN_HOST/api/3/action/help_show?name=package_show_as_datapackage\",\n \"success\": true,\n \"result\": {\n \"name\": \"bond-yields-uk-2-7334836228\",\n \"title\": \"Test Data Package\",\n \"resources\": [\n {\"url\": \"http://some.file\",\n \"format\": \"CSV\"}\n ]\n }\n }\n\nOr if using ckanapi:\n\n ckanapi action package_show_as_datapackage id=PACKAGE_ID -r http://CKAN_URL\n\nNote that this returns the standard CKAN API output where the `datapackage.json` file is returned under the `result` key.\nIf you would rather like to get the `datapackage.json` file directly you can use this direct endpoint:\n\n http://CKAN_HOST/dataset/DATASET_NAME_OR_ID/datapackage.json\n\nFor instance\n\n curl http://CKAN_HOST/dataset/bond-yields-uk-10y/datapackage.json\n\n\n## Developing ckanext-datapackager\n\n### Running tests\n\nYou'll need to install the dev requirements to run the tests:\n\n pip install -r dev-requirements.txt\n\nTo run the tests:\n\n nosetests --nologcapture --ckan --with-pylons=test.ini\n\nNote that ckanext-datapackager's `test.ini` file assumes that the relative path from it\nto CKAN's `test-core.ini` file is `../ckan/test-core.ini`, i.e. that you have\nCKAN and ckanext-datapackager installed next to each other in the same directory. This\nwould normally be the case if you've done development installs of CKAN and\nckanext-datapackager.\n\n## Where is the old Open Knowledge's Data Packager?\n\nThe [Open Knowledge Data Packager](http://datapackager.okfn.org) was written for\nan old CKAN version (2.2), and is now deprecated. This extension implements\nparts of its functionality and improves them, supporting the current CKAN\nversion (2.4).\n\nIf you still need the old Data Packager, checkout this repository's commit\n[57cff1f](https://github.com/ckan/ckanext-datapackager/commit/57cff1f5112504091891195a097433579275f968).\n\n[ckan]: http://ckan.org\n[data-packages]: http://dataprotocols.org/data-packages/\n[ckanapi]: https://github.com/ckan/ckanapi", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ckan/ckanext-datapackager", "keywords": "CKAN datapackages", "license": "AGPL", "maintainer": null, "maintainer_email": null, "name": "ckanext-datapackager", "package_url": "https://pypi.org/project/ckanext-datapackager/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ckanext-datapackager/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ckan/ckanext-datapackager" }, "release_url": "https://pypi.org/project/ckanext-datapackager/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "This extension adds importing and exporting of Data Packages to CKAN datasets.", "version": "0.2.0" }, "last_serial": 3820914, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "b15b857530ba52c77156a3d0f2b12fc2", "sha256": "d52c270bc3d4a4b80cd37ef293015c9bb3cde081956786266adbac193aec03c1" }, "downloads": -1, "filename": "ckanext-datapackager-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b15b857530ba52c77156a3d0f2b12fc2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18282, "upload_time": "2016-06-07T08:22:51", "url": "https://files.pythonhosted.org/packages/a6/fa/1c40243476d4fcb37ae0bb5ffd4c55ddb82ff9af2f874824bea3093356cf/ckanext-datapackager-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b15b857530ba52c77156a3d0f2b12fc2", "sha256": "d52c270bc3d4a4b80cd37ef293015c9bb3cde081956786266adbac193aec03c1" }, "downloads": -1, "filename": "ckanext-datapackager-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b15b857530ba52c77156a3d0f2b12fc2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18282, "upload_time": "2016-06-07T08:22:51", "url": "https://files.pythonhosted.org/packages/a6/fa/1c40243476d4fcb37ae0bb5ffd4c55ddb82ff9af2f874824bea3093356cf/ckanext-datapackager-0.2.0.tar.gz" } ] }