ckanext-resource-docs


Nameckanext-resource-docs JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
SummaryA CKAN extension that lets you attach a flexible, schema-free data dictionary (“resource documentation”) to any resource, not just Datastore-backed ones.
upload_time2025-08-14 10:37:02
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseAGPL
keywords ckan
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            [![Tests](https://github.com/DataShades/ckanext-resource-docs/actions/workflows/test.yml/badge.svg)](https://github.com/DataShades/ckanext-resource-docs/actions/workflows/test.yml)

A CKAN extension that allows attaching a flexible data dictionary (resource documentation) to any resource — not just those backed by the Datastore.

Each resource’s documentation can include a validation schema defined individually using JSON Schema Draft 2020-12, enabling optional enforcement of structure and constraints while maintaining the flexibility of a free-form data dictionary.

The official specification for JSON Schema Draft 2020-12 is available [here](https://json-schema.org/draft/2020-12/).

Here is an example of a resource documentation in a format of Datastore fields. But it's not limited to that format, you can save any custom data you need.

![Documentation table](./docs/rdoc-1.png)

It's also possible to define a validation schema for the resource documentation, which will be used to validate the documentation data.

![Validation schema](./docs/rdoc-2.png)

- [Requirements](#requirements)
- [Installation](#installation)
- [Config settings](#config-settings)
  - [ckanext.resource\_docs.append\_docs\_to\_resource\_api](#ckanextresource_docsappend_docs_to_resource_api)
  - [ckanext.resource\_docs.api\_field\_name](#ckanextresource_docsapi_field_name)
  - [Example API response](#example-api-response)
- [Developer installation](#developer-installation)
- [Tests](#tests)
- [License](#license)

## Requirements

Compatibility with core CKAN versions:

| CKAN version    | Compatible?   |
| --------------- | ------------- |
| 2.9 and earlier | no            |
| 2.10+           | yes           |

## Installation
To install ckanext-resource-docs:

1. Activate your CKAN virtual environment, for example:

    ```bash
    . /usr/lib/ckan/default/bin/activate
    ```

2. Install the extension from PyPI:

    ```bash
    pip install ckanext-resource-docs
    ```

3. Add `resource_docs` to the `ckan.plugins` setting in your CKAN config file (usually located at `/etc/ckan/default/ckan.ini`).

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

    ```bash
    sudo service apache2 reload
    ```


## Config settings

The following options control how ckanext-resource-docs behaves.

### ckanext.resource_docs.append_docs_to_resource_api

Type: `bool`

Default: `false`

When `true`, resource documentation is automatically included in the standard CKAN resource API response. This allows clients to retrieve documentation without making a separate API call.

Example:
```ini
ckanext.resource_docs.append_docs_to_resource_api = true
```

---

### ckanext.resource_docs.api_field_name

Type: `string`

Default: `resource_docs`

Specifies the field name in the API response that will contain the resource documentation. Only applies if `append_docs_to_resource_api` is enabled.

Example:
```ini
ckanext.resource_docs.api_field_name = documentation
```

With this setting, the documentation appears under "documentation" field instead of "resource_docs".

---

### Example API response

With `append_docs_to_resource_api = true` and the default `api_field_name`:

```json
{
  "id": "resource-id-123",
  "name": "my-resource.csv",
  "url": "https://example.com/data.csv",
  "format": "CSV",
  "resource_docs": {
    "documentation": "This dataset contains...",
    "fields": [
      {
        "name": "column1",
        "description": "Description of column1",
        "type": "string"
      }
    ]
  }
}
```

## Developer installation

To install ckanext-resource-docs for development, activate your CKAN virtualenv and
do:
```sh
git clone https://github.com/DataShades/ckanext-resource-docs.git
cd ckanext-resource-docs
pip install -e .
```

## Tests

To run the tests, do:

```sh
pytest --ckan-ini=test.ini
```

## License

[AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ckanext-resource-docs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "CKAN",
    "author": null,
    "author_email": "Oleksandr Cherniavskiy <mutantsan@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a4/ea/28ee03749efcbe9532349b001f6189edc326c3aaf54b1a4b8acd68fdbfb5/ckanext_resource_docs-0.2.2.tar.gz",
    "platform": null,
    "description": "[![Tests](https://github.com/DataShades/ckanext-resource-docs/actions/workflows/test.yml/badge.svg)](https://github.com/DataShades/ckanext-resource-docs/actions/workflows/test.yml)\n\nA CKAN extension that allows attaching a flexible data dictionary (resource documentation) to any resource \u2014 not just those backed by the Datastore.\n\nEach resource\u2019s documentation can include a validation schema defined individually using JSON Schema Draft 2020-12, enabling optional enforcement of structure and constraints while maintaining the flexibility of a free-form data dictionary.\n\nThe official specification for JSON Schema Draft 2020-12 is available [here](https://json-schema.org/draft/2020-12/).\n\nHere is an example of a resource documentation in a format of Datastore fields. But it's not limited to that format, you can save any custom data you need.\n\n![Documentation table](./docs/rdoc-1.png)\n\nIt's also possible to define a validation schema for the resource documentation, which will be used to validate the documentation data.\n\n![Validation schema](./docs/rdoc-2.png)\n\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Config settings](#config-settings)\n  - [ckanext.resource\\_docs.append\\_docs\\_to\\_resource\\_api](#ckanextresource_docsappend_docs_to_resource_api)\n  - [ckanext.resource\\_docs.api\\_field\\_name](#ckanextresource_docsapi_field_name)\n  - [Example API response](#example-api-response)\n- [Developer installation](#developer-installation)\n- [Tests](#tests)\n- [License](#license)\n\n## Requirements\n\nCompatibility with core CKAN versions:\n\n| CKAN version    | Compatible?   |\n| --------------- | ------------- |\n| 2.9 and earlier | no            |\n| 2.10+           | yes           |\n\n## Installation\nTo install ckanext-resource-docs:\n\n1. Activate your CKAN virtual environment, for example:\n\n    ```bash\n    . /usr/lib/ckan/default/bin/activate\n    ```\n\n2. Install the extension from PyPI:\n\n    ```bash\n    pip install ckanext-resource-docs\n    ```\n\n3. Add `resource_docs` to the `ckan.plugins` setting in your CKAN config file (usually located at `/etc/ckan/default/ckan.ini`).\n\n4. Restart CKAN. For example, if you've deployed CKAN with Apache on Ubuntu:\n\n    ```bash\n    sudo service apache2 reload\n    ```\n\n\n## Config settings\n\nThe following options control how ckanext-resource-docs behaves.\n\n### ckanext.resource_docs.append_docs_to_resource_api\n\nType: `bool`\n\nDefault: `false`\n\nWhen `true`, resource documentation is automatically included in the standard CKAN resource API response. This allows clients to retrieve documentation without making a separate API call.\n\nExample:\n```ini\nckanext.resource_docs.append_docs_to_resource_api = true\n```\n\n---\n\n### ckanext.resource_docs.api_field_name\n\nType: `string`\n\nDefault: `resource_docs`\n\nSpecifies the field name in the API response that will contain the resource documentation. Only applies if `append_docs_to_resource_api` is enabled.\n\nExample:\n```ini\nckanext.resource_docs.api_field_name = documentation\n```\n\nWith this setting, the documentation appears under \"documentation\" field instead of \"resource_docs\".\n\n---\n\n### Example API response\n\nWith `append_docs_to_resource_api = true` and the default `api_field_name`:\n\n```json\n{\n  \"id\": \"resource-id-123\",\n  \"name\": \"my-resource.csv\",\n  \"url\": \"https://example.com/data.csv\",\n  \"format\": \"CSV\",\n  \"resource_docs\": {\n    \"documentation\": \"This dataset contains...\",\n    \"fields\": [\n      {\n        \"name\": \"column1\",\n        \"description\": \"Description of column1\",\n        \"type\": \"string\"\n      }\n    ]\n  }\n}\n```\n\n## Developer installation\n\nTo install ckanext-resource-docs for development, activate your CKAN virtualenv and\ndo:\n```sh\ngit clone https://github.com/DataShades/ckanext-resource-docs.git\ncd ckanext-resource-docs\npip install -e .\n```\n\n## Tests\n\nTo run the tests, do:\n\n```sh\npytest --ckan-ini=test.ini\n```\n\n## License\n\n[AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)\n",
    "bugtrack_url": null,
    "license": "AGPL",
    "summary": "A CKAN extension that lets you attach a flexible, schema-free data dictionary (\u201cresource documentation\u201d) to any resource, not just Datastore-backed ones.",
    "version": "0.2.2",
    "project_urls": {
        "Homepage": "https://github.com/DataShades/ckanext-resource-docs"
    },
    "split_keywords": [
        "ckan"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "768c833d83bd194f479b1aee56ca8c03c94cafe0150eaa9937e2e29cc234eaa2",
                "md5": "14bb23e1cd19df6a93d4a21b4680f60b",
                "sha256": "3fdb51d50ae32b140221049e5ff8091bb8955b9f7c876fa42b8bd5ffc143eab3"
            },
            "downloads": -1,
            "filename": "ckanext_resource_docs-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "14bb23e1cd19df6a93d4a21b4680f60b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 334206,
            "upload_time": "2025-08-14T10:37:01",
            "upload_time_iso_8601": "2025-08-14T10:37:01.122622Z",
            "url": "https://files.pythonhosted.org/packages/76/8c/833d83bd194f479b1aee56ca8c03c94cafe0150eaa9937e2e29cc234eaa2/ckanext_resource_docs-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a4ea28ee03749efcbe9532349b001f6189edc326c3aaf54b1a4b8acd68fdbfb5",
                "md5": "84f5e84f2d109fe64a0313360e2844f4",
                "sha256": "2a83b4eac3a5728f20a2f99160d268d33d8a96995eefdf56cfdb6f9511f7f948"
            },
            "downloads": -1,
            "filename": "ckanext_resource_docs-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "84f5e84f2d109fe64a0313360e2844f4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 329615,
            "upload_time": "2025-08-14T10:37:02",
            "upload_time_iso_8601": "2025-08-14T10:37:02.617812Z",
            "url": "https://files.pythonhosted.org/packages/a4/ea/28ee03749efcbe9532349b001f6189edc326c3aaf54b1a4b8acd68fdbfb5/ckanext_resource_docs-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-14 10:37:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DataShades",
    "github_project": "ckanext-resource-docs",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "ckanext-resource-docs"
}
        
Elapsed time: 0.44557s