| Name | ckanext-pygments JSON |
| Version |
1.2.5
JSON |
| download |
| home_page | None |
| Summary | Provides previews with syntax highlight for multiple formats |
| upload_time | 2025-10-25 09:48:59 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | None |
| license | AGPL |
| keywords |
ckan
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
|
# ckanext-pygments
This extension provides a preview with syntax highlight for multiple text resources formats.

## Installation
Install from source
```sh
pip install -e .
```
Or use `pip`
```sh
pip install ckanext-pygments
```
Enable the plugin and the view in your CKAN config file:
```
ckan.plugins = pygments_view
ckan.views.default_views = pygments_view
```
## Caching
There is a caching mechanism implemented in this extension. It is disabled by default. To enable it, set `ckanext.pygments.cache.enable` to `True`. You can also set the time to live for the cache in seconds with `ckanext.pygments.cache.ttl`. The default is 7200 seconds (2 hours). You can also set the maximum size of the resource to cache in bytes with `ckanext.pygments.cache.resouce_max_size`. The default is 20MB.
### Why cache is disabled by default?
We use Redis for caching and it uses memory. If you have a lot of resources and they are big, you can run out of memory. That's why it is disabled by default.
It's still debatable if we need cache at all. Big resource processed with pygments will be even bigger. So we can have a lot of memory usage. But if we have a lot of resources and many users access it, we can save a lot of time on processing.
### Admin configuration page
If you're using the [ckanext-admin-panel](https://github.com/DataShades/ckanext-admin-panel) extension, you can configure the pygments settings from the admin panel. Otherwise, you can configure it in the `ckan.ini` file.
## Config settings
See [config declaration file](./ckanext/pygments/config_declaration.yaml)
## Tests
To run the tests, do:
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-pygments",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": "DataShades <datashades@linkdigital.com.au>",
"keywords": "CKAN",
"author": null,
"author_email": "DataShades <datashades@linkdigital.com.au>, Sergey Motornyuk <sergey.motornyuk@linkdigital.com.au>, Oleksandr Cherniavskyi <mutantsan@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/0b/28/33af29c3577cab46dde1bbc79391366801f99a5d0d28cfa135d481267c6f/ckanext_pygments-1.2.5.tar.gz",
"platform": null,
"description": "# ckanext-pygments\n\nThis extension provides a preview with syntax highlight for multiple text resources formats.\n\n\n\n## Installation\n\nInstall from source\n```sh\npip install -e .\n```\n\nOr use `pip`\n```sh\npip install ckanext-pygments\n```\n\nEnable the plugin and the view in your CKAN config file:\n```\nckan.plugins = pygments_view\nckan.views.default_views = pygments_view\n```\n\n## Caching\nThere is a caching mechanism implemented in this extension. It is disabled by default. To enable it, set `ckanext.pygments.cache.enable` to `True`. You can also set the time to live for the cache in seconds with `ckanext.pygments.cache.ttl`. The default is 7200 seconds (2 hours). You can also set the maximum size of the resource to cache in bytes with `ckanext.pygments.cache.resouce_max_size`. The default is 20MB.\n\n### Why cache is disabled by default?\nWe use Redis for caching and it uses memory. If you have a lot of resources and they are big, you can run out of memory. That's why it is disabled by default.\nIt's still debatable if we need cache at all. Big resource processed with pygments will be even bigger. So we can have a lot of memory usage. But if we have a lot of resources and many users access it, we can save a lot of time on processing.\n\n### Admin configuration page\nIf you're using the [ckanext-admin-panel](https://github.com/DataShades/ckanext-admin-panel) extension, you can configure the pygments settings from the admin panel. Otherwise, you can configure it in the `ckan.ini` file.\n\n## Config settings\n\nSee [config declaration file](./ckanext/pygments/config_declaration.yaml)\n\n## Tests\n\nTo run the tests, do:\n\n pytest --ckan-ini=test.ini\n\n## License\n\n[AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)\n",
"bugtrack_url": null,
"license": "AGPL",
"summary": "Provides previews with syntax highlight for multiple formats",
"version": "1.2.5",
"project_urls": {
"Homepage": "https://github.com/DataShades/ckanext-pygments"
},
"split_keywords": [
"ckan"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "10281bf83386c5aa6df33e197cb30efb09cb5a99af951bca8b156d93d45d8055",
"md5": "51f09070300e158c738b0cb968df519e",
"sha256": "c9b499149628d4d7795e09324380fa93ed6b92551d8eb729b7f395fedfef684c"
},
"downloads": -1,
"filename": "ckanext_pygments-1.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "51f09070300e158c738b0cb968df519e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 47233,
"upload_time": "2025-10-25T09:48:57",
"upload_time_iso_8601": "2025-10-25T09:48:57.628283Z",
"url": "https://files.pythonhosted.org/packages/10/28/1bf83386c5aa6df33e197cb30efb09cb5a99af951bca8b156d93d45d8055/ckanext_pygments-1.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0b2833af29c3577cab46dde1bbc79391366801f99a5d0d28cfa135d481267c6f",
"md5": "e0a5a2a507b3f7355032835117215b71",
"sha256": "775e98031fa09cd90e5665c780ccb7160a3b290cef7e06127afd300feb3a0656"
},
"downloads": -1,
"filename": "ckanext_pygments-1.2.5.tar.gz",
"has_sig": false,
"md5_digest": "e0a5a2a507b3f7355032835117215b71",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 43140,
"upload_time": "2025-10-25T09:48:59",
"upload_time_iso_8601": "2025-10-25T09:48:59.035799Z",
"url": "https://files.pythonhosted.org/packages/0b/28/33af29c3577cab46dde1bbc79391366801f99a5d0d28cfa135d481267c6f/ckanext_pygments-1.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-25 09:48:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DataShades",
"github_project": "ckanext-pygments",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "ckanext-pygments"
}