[![License](https://img.shields.io/github/license/depositar/ckanext-ark)](https://opensource.org/licenses/MIT)
[![Tests](https://github.com/depositar/ckanext-ark/workflows/Tests/badge.svg)](https://github.com/depositar/ckanext-ark/actions)
[![Codecov](https://codecov.io/gh/depositar/ckanext-ark/branch/main/graph/badge.svg)](https://codecov.io/gh/depositar/ckanext-ark)
[![Python](https://img.shields.io/pypi/pyversions/ckanext-ark)](https://pypi.org/project/ckanext-ark)
[![CKAN](https://img.shields.io/badge/ckan-2.9-orange.svg)](https://github.com/ckan/ckan)
# ckanext-ark
This extension provides minter and resolver of the [ARK Identifier](https://datatracker.ietf.org/doc/draft-kunze-ark/). Inspired by [ckanext-doi](https://github.com/NaturalHistoryMuseum/ckanext-doi).
## Requirements
Compatibility with core CKAN versions:
| CKAN version | Compatible? |
| --------------- | ------------- |
| 2.8 and earlier | no |
| 2.9 | yes |
| 2.10 | yes |
This extension is compatible with Python 3.8, 3.9, and 3.10.
## Installation
To install ckanext-ark:
1. Activate your CKAN virtual environment, for example:
```bash
. /usr/lib/ckan/default/bin/activate
```
2. Install the ckanext-ark Python package into your virtual environment:
```bash
pip install ckanext-ark
```
3. Add `ark` to the `ckan.plugins` setting in your CKAN
config file (by default the config file is located at
`/etc/ckan/default/ckan.ini`).
4. Add a file `templates/package/read_base.html` in your custom extension
(or modify `/usr/lib/ckan/default/src/ckan/ckan/templates/package/read_base.html` if
you are not using a custom extension):
```html
{% ckan_extends %}
{% block secondary_content %}
{{ super() }}
{% snippet "ark/snippets/ark.html" %}
{% endblock %}
```
5. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
```bash
sudo service apache2 reload
```
6. Initialize the database:
```bash
ckan -c /etc/ckan/default/ckan.ini ark initdb
```
## Development Installation
To install ckanext-ark for development, activate your CKAN virtualenv and
do:
```bash
git clone https://github.com/depositar/ckanext-ark.git
cd ckanext-ark
python setup.py develop
pip install -r dev-requirements.txt
```
## Config settings
### ARK NAAN **[REQUIRED]**
You can request a Name Assigning Authority Number (NAAN) through this [form](https://goo.gl/forms/bmckLSPpbzpZ5dix1).
```ini
ckanext.ark.naan = 99999 # This NAAN is for test purpose only
```
### Other ARK configs
Name | Description | Default
-- | -- | --
`ckanext.ark.nma_url` | The URL of NMA (Name Mapping Authority) | The same URL as `ckan.site_url`
`ckanext.ark.shoulder` | The [Shoulder](https://arks.org/about/shoulders/) for subdividing a NAAN namespace |
`ckanext.ark.template` | The template for generating ARKs | zek
### ERC record (ARK metadata) configs
Name | Description | Default
-- | -- | --
`ckanext.ark.erc_mappings` | A mapping from ERC record to CKAN fields[^mapping_when] | {"who": "author", "what": "title", "when": ""}
`ckanext.ark.allow_missing_erc` | This controls if still assigning ARKs even if the fields defined in the `ckanext.ark.erc_mappings` is missing or empty[^missing_when] | True
`ckanext.ark.erc_support.who` | Who made the ARK support commitment |
`ckanext.ark.erc_support.what` | What the nature of the ARK support commitment was |
`ckanext.ark.erc_support.when` | When the ARK support commitment was made |
`ckanext.ark.erc_support.commitment` | A fuller explanation of the ARK support commitment |
[^mapping_when]: For the mapping of `when` field, the ISO 8601 YYYY-MM-DD is recommended. The date string will be converted to [Temporal Enumerated Ranges (TEMPER)](https://datatracker.ietf.org/doc/draft-kunze-temper/) format (YYYYMMDD-YYYYMMDD). Note that the date validation is omitted.
[^missing_when]: For the `when` field, a list containing a single value is not viewed as an empty value.
## Commands
### `ark`
1. `delete-ark`: delete ARK identifier for existed dataset. Accept package's id (name) and ARK identifier (with and without `ark:`).
```bash
ckan -c /etc/ckan/default/ckan.ini ark delete-ark [NAME]
```
2. `update-ark`: give ARK identifiers to existed datasets.
```bash
ckan -c /etc/ckan/default/ckan.ini ark update-ark
```
## Tests
To run the tests, do:
```bash
pytest --ckan-ini=test.ini
```
## Releasing a new version of ckanext-ark
ckanext-ark is available on PyPI as https://pypi.python.org/pypi/ckanext-ark. You can follow these steps to publish a new version:
1. Update the version number in the `setup.py` file. See [PEP 440](http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers) for how to choose version numbers.
2. Make sure you have the latest version of necessary packages:
```bash
pip install --upgrade build twine
```
3. Create a source and binary distributions of the new version:
```bash
python -m build
```
Fix any errors you get.
4. Upload the source distribution to PyPI:
```bash
twine upload dist/*
```
5. Commit any outstanding changes:
```bash
git commit -a
git push
```
6. 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
1.0.1 then do:
```bash
git tag v1.0.1
git push --tags
```
## License
[MIT](https://opensource.org/licenses/MIT)
Raw data
{
"_id": null,
"home_page": "https://github.com/depositar/ckanext-ark",
"name": "ckanext-ark",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "CKAN ARK",
"author": "Cheng-Jen Lee",
"author_email": "u103133.u103135@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/97/1b/6ef82b5b90d7e86f9f892817a75a3aec3e974a36e0179ed031039bd0424a/ckanext_ark-1.0.3.tar.gz",
"platform": null,
"description": "[![License](https://img.shields.io/github/license/depositar/ckanext-ark)](https://opensource.org/licenses/MIT)\n[![Tests](https://github.com/depositar/ckanext-ark/workflows/Tests/badge.svg)](https://github.com/depositar/ckanext-ark/actions)\n[![Codecov](https://codecov.io/gh/depositar/ckanext-ark/branch/main/graph/badge.svg)](https://codecov.io/gh/depositar/ckanext-ark)\n[![Python](https://img.shields.io/pypi/pyversions/ckanext-ark)](https://pypi.org/project/ckanext-ark)\n[![CKAN](https://img.shields.io/badge/ckan-2.9-orange.svg)](https://github.com/ckan/ckan)\n\n# ckanext-ark\n\nThis extension provides minter and resolver of the [ARK Identifier](https://datatracker.ietf.org/doc/draft-kunze-ark/). Inspired by [ckanext-doi](https://github.com/NaturalHistoryMuseum/ckanext-doi).\n\n## Requirements\n\nCompatibility with core CKAN versions:\n\n| CKAN version | Compatible? |\n| --------------- | ------------- |\n| 2.8 and earlier | no |\n| 2.9 | yes |\n| 2.10 | yes |\n\nThis extension is compatible with Python 3.8, 3.9, and 3.10.\n\n## Installation\n\nTo install ckanext-ark:\n\n1. Activate your CKAN virtual environment, for example:\n\n```bash\n . /usr/lib/ckan/default/bin/activate\n```\n\n2. Install the ckanext-ark Python package into your virtual environment:\n\n```bash\n pip install ckanext-ark\n```\n\n3. Add `ark` to the `ckan.plugins` setting in your CKAN\n config file (by default the config file is located at\n `/etc/ckan/default/ckan.ini`).\n\n4. Add a file `templates/package/read_base.html` in your custom extension\n (or modify `/usr/lib/ckan/default/src/ckan/ckan/templates/package/read_base.html` if\n you are not using a custom extension):\n\n```html\n {% ckan_extends %}\n\n {% block secondary_content %}\n {{ super() }}\n {% snippet \"ark/snippets/ark.html\" %}\n {% endblock %}\n```\n\n5. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:\n\n```bash\n sudo service apache2 reload\n```\n\n6. Initialize the database:\n\n```bash\n ckan -c /etc/ckan/default/ckan.ini ark initdb\n```\n\n## Development Installation\n\nTo install ckanext-ark for development, activate your CKAN virtualenv and\ndo:\n\n```bash\n git clone https://github.com/depositar/ckanext-ark.git\n cd ckanext-ark\n python setup.py develop\n pip install -r dev-requirements.txt\n```\n\n## Config settings\n\n### ARK NAAN **[REQUIRED]**\n\nYou can request a Name Assigning Authority Number (NAAN) through this [form](https://goo.gl/forms/bmckLSPpbzpZ5dix1).\n\n```ini\n ckanext.ark.naan = 99999 # This NAAN is for test purpose only\n```\n\n### Other ARK configs\n\nName | Description | Default\n-- | -- | --\n`ckanext.ark.nma_url` | The URL of NMA (Name Mapping Authority) | The same URL as `ckan.site_url`\n`ckanext.ark.shoulder` | The [Shoulder](https://arks.org/about/shoulders/) for subdividing a NAAN namespace |\n`ckanext.ark.template` | The template for generating ARKs | zek\n\n### ERC record (ARK metadata) configs\n\nName | Description | Default\n-- | -- | --\n`ckanext.ark.erc_mappings` | A mapping from ERC record to CKAN fields[^mapping_when] | {\"who\": \"author\", \"what\": \"title\", \"when\": \"\"}\n`ckanext.ark.allow_missing_erc` | This controls if still assigning ARKs even if the fields defined in the `ckanext.ark.erc_mappings` is missing or empty[^missing_when] | True\n`ckanext.ark.erc_support.who` | Who made the ARK support commitment |\n`ckanext.ark.erc_support.what` | What the nature of the ARK support commitment was |\n`ckanext.ark.erc_support.when` | When the ARK support commitment was made |\n`ckanext.ark.erc_support.commitment` | A fuller explanation of the ARK support commitment |\n\n[^mapping_when]: For the mapping of `when` field, the ISO 8601 YYYY-MM-DD is recommended. The date string will be converted to [Temporal Enumerated Ranges (TEMPER)](https://datatracker.ietf.org/doc/draft-kunze-temper/) format (YYYYMMDD-YYYYMMDD). Note that the date validation is omitted.\n[^missing_when]: For the `when` field, a list containing a single value is not viewed as an empty value.\n\n## Commands\n\n### `ark`\n\n1. `delete-ark`: delete ARK identifier for existed dataset. Accept package's id (name) and ARK identifier (with and without `ark:`).\n\n```bash\n ckan -c /etc/ckan/default/ckan.ini ark delete-ark [NAME]\n```\n\n2. `update-ark`: give ARK identifiers to existed datasets.\n\n```bash\n ckan -c /etc/ckan/default/ckan.ini ark update-ark\n```\n\n## Tests\n\nTo run the tests, do:\n\n```bash\n pytest --ckan-ini=test.ini\n```\n\n## Releasing a new version of ckanext-ark\n\nckanext-ark is available on PyPI as https://pypi.python.org/pypi/ckanext-ark. You can follow these steps to publish a new version:\n\n1. Update the version number in the `setup.py` file. See [PEP 440](http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers) for how to choose version numbers.\n\n2. Make sure you have the latest version of necessary packages:\n\n```bash\n pip install --upgrade build twine\n```\n\n3. Create a source and binary distributions of the new version:\n\n```bash\n python -m build\n```\n\n Fix any errors you get.\n\n4. Upload the source distribution to PyPI:\n\n```bash\n twine upload dist/*\n```\n\n5. Commit any outstanding changes:\n\n```bash\n git commit -a\n git push\n```\n\n6. Tag the new release of the project on GitHub with the version number from\n the `setup.py` file. For example if the version number in `setup.py` is\n 1.0.1 then do:\n\n```bash\n git tag v1.0.1\n git push --tags\n```\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A CKAN extension for assigning Archival Resource Key (ARK) identifiers to datasets.",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/depositar/ckanext-ark"
},
"split_keywords": [
"ckan",
"ark"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7ec27f707cc1029396e2cb61d0a0dec11c84e95b3d957a580dc3352130d5c48c",
"md5": "20d56bf4b3d0921fed6dbd8fc4c5458a",
"sha256": "859b961571a0fb3faecc6351515bdb1629418b30397cac24620819c196640e1b"
},
"downloads": -1,
"filename": "ckanext_ark-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "20d56bf4b3d0921fed6dbd8fc4c5458a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 14147,
"upload_time": "2024-05-20T05:07:13",
"upload_time_iso_8601": "2024-05-20T05:07:13.074114Z",
"url": "https://files.pythonhosted.org/packages/7e/c2/7f707cc1029396e2cb61d0a0dec11c84e95b3d957a580dc3352130d5c48c/ckanext_ark-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "971b6ef82b5b90d7e86f9f892817a75a3aec3e974a36e0179ed031039bd0424a",
"md5": "8af20f1860ed7788673cd96173520619",
"sha256": "1e7ccbb07cbf6f941eb73018f27240823eb044fbb447a6d6a52c9dc48b4c1245"
},
"downloads": -1,
"filename": "ckanext_ark-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "8af20f1860ed7788673cd96173520619",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13739,
"upload_time": "2024-05-20T05:07:14",
"upload_time_iso_8601": "2024-05-20T05:07:14.992947Z",
"url": "https://files.pythonhosted.org/packages/97/1b/6ef82b5b90d7e86f9f892817a75a3aec3e974a36e0179ed031039bd0424a/ckanext_ark-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-20 05:07:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "depositar",
"github_project": "ckanext-ark",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "ckanext-ark"
}