Extension Extended Template


Extension Basics

Title
Extended Template
Name
ckanext-sk-demo
Type
Public extension
Description
Extended CKAN extension template with comprehensive tooling
CKAN versions

~2.9, ~2.10, ~2.11

Show details
Download-Url (zip)
Download-Url commit date
2025-02-09
Url to repo
Category
Specialized Tools


Background Infos

Description (long)
Show details

A comprehensive template for creating professional CKAN extensions with modern development practices and extensive tooling. This is not a functional extension but rather a scaffold/template generated using ‘ctb make ckanext extended’ from ckanext-toolbelt v0.4.21+. The template includes: 3-layer configuration system (default.ini, project.ini, ckan.ini), blanket decorators for automatic interface registration (actions, auth_functions, blueprints, cli, config_declarations, helpers, validators), implementations pattern for complex interfaces, pre-configured git hooks with ruff/pre-commit, asset builder with gulp/SCSS compilation, pyright type checker, pytest unit tests with benchmarks, cypress e2e tests, mkdocs documentation server, CDM dependency management via Makefile, SOLR schema in config/, and integration examples for 20+ popular extensions (admin-panel, cloudstorage, collection, comments, dcat, editable-config, files, flakes, geoview, googleanalytics, harvest, hierarchy, let-me-in, officedocs, or-facet, pdfview, pygments, resource-indexer, saml, scheming, syndicate, search-tweaks, spatial, toolbelt, unfold, vip-portal, xloader). Compatible with CKAN 2.10, 2.11, and master. Full usage guide available via ‘mkdocs serve’ after installation.

Version
0.0.1
Version release date
2025-02-09
Contact name
Sergey Motornyuk
Contakt email
Contact Url
(not set)


Installation Guide

Configuration hints

Template Creation: Install ckanext-toolbelt v0.4.21+ with ‘pip install -U ckanext-toolbelt’. Generate extension with ‘ctb make ckanext extended’ (interactive) or ‘ctb make ckanext extended my-ext -d’ (default answers). Installation: cd ckanext-my-ext/, pip install -e ‘.[dev]’, git init, pre-commit install. Optional CKAN Setup: make prepare, make full-upgrade develop=1, ckan generate config default.ini, ckan generate config ckan.ini, ln -snf ckanext-my-ext/config/* ./, create SOLR core, create DB, apply migrations: ckan db upgrade && ckan db pending-migrations –apply. Documentation Server: mkdocs serve (available at localhost:8000). Configuration Pattern: 3-layer system - default.ini (CKAN defaults), project.ini (project-specific safe settings), ckan.ini (environment-specific secrets). Blanket Decorators: Automatic registration - @tk.blanket.actions for logic/action.py, @tk.blanket.auth_functions for logic/auth.py, @tk.blanket.blueprints for views.py, @tk.blanket.cli for cli.py, @tk.blanket.config_declarations for config_declaration.yaml, @tk.blanket.helpers for helpers.py, @tk.blanket.validators for logic/validators.py. Complex Interfaces: Create implementations/ modules following interface name pattern (IPackageController → implementations/package_controller.py). Git Hooks: pre-commit install (end-of-file-fixer, trailing-whitespace, ruff, ruff-format), optional security: gitleaks, talisman. Asset Building: npm ci, npm run dev (watch mode), npm run build (production). Type Checking: npx pyright or make typecheck. Code Style: ruff check ., ruff check –fix ., ruff format .. Testing: pytest (all), pytest –cov=ckanext.sk_demo (coverage), pytest -m benchmark (benchmarks), pytest –lf (last failed), pytest -x (stop on first fail). E2E Testing: make test-server (separate terminal), npx cypress run (headless), npx cypress open (interactive). CDM Dependency Management: make prepare (initialize), make full-upgrade (install all), make full-upgrade develop=1 (with dev deps), make ckan-sync ckan-install (CKAN only), make sync install (extensions only), make sync-NAME install-NAME (single extension), make full-upgrade alternative=dev (alternative versions). Included Extensions Config: See README sections for admin-panel, cloudstorage, collection, comments, dcat, editable-config, files, flakes, geoview, googleanalytics, harvest, hierarchy, let-me-in, officedocs, or-facet, pdfview, pygments, resource-indexer, saml, scheming, syndicate, search-tweaks, spatial, toolbelt, unfold, vip-portal, xloader. Dependencies: typing_extensions, pyyaml. Python 3.9+ required. This is a TEMPLATE for creating extensions, not a standalone functional extension.

Plugins to configure (ckan.ini)
sk_demo
CKAN Settings (ckan.ini)
# ckanext.xloader.api_token = %(CKAN_XLOADER_API_TOKEN)s # use = config:project.ini(to use project.ini as source for defaults) and # ckanext.cloudstorage.container_name = <BUCKET> # ckanext.cloudstorage.driver = S3 # ckanext.cloudstorage.driver_options = {"key": "<KEY>", "secret": "<SECRET>", "host": "s3.ap-southeast-2.amazonaws.com"} # ckanext.files.storage.default.type = files:fs # ckanext.files.storage.default.path = %(here)s/storage # ckanext.files.storage.default.create_path = true
DB migration to be executed
ckan
<< back to Extensions