ckantools
Utilities and common methods for CKAN extensions.
Overview
A collection of methods, decorators, and anything else that might be useful.
ckantools is still very much in development, and is prone to frequent changes that may or may not work.
Installation
pip install ckantools
Usage
See the full usage docs on readthedocs.io.
Actions
Use the @action decorator to add actions:
# logic/actions/module_name.py
from ckantools.decorators import action
@action(schema, helptext, get=False, *other_decorators)
def example_action(parameter_1, parameter_2):
# ...
Or the @basic_action decorator if you want to load the action but don't want any of the other features (schema loading, auto auth, etc):
from ckantools.decorators import basic_action
@basic_action
def example_action(context, data_dict):
# ...
And then load the action(s) in plugin.py:
# plugin.py
from .logic.actions import module_name
from ckantools.loaders import create_actions
from ckan.plugins import implements, interfaces, SingletonPlugin
class ExamplePlugin(SingletonPlugin):
implements(interfaces.IActions)
# IActions
def get_actions(self):
return create_actions(module_name)
Auth
Loading auth functions is similar to actions, i.e. use the @auth decorator.
# logic/auth/module_name.py
from ckantools.decorators import auth
@auth(anon=True)
def example_action(context, data_dict):
return {'success': True}
@auth('example_action')
def other_action(context, data_dict):
# checks access to example_action first
return {'success': True}
The auth functions can then be loaded in plugin.py:
# plugin.py
from .logic.auth import module_name
from ckantools.loaders import create_auth
from ckan.plugins import implements, interfaces, SingletonPlugin
class ExamplePlugin(SingletonPlugin):
implements(interfaces.IActions)
# IAuthFunctions
def get_auth_functions(self):
return create_auth(module_name)
Metadata
Release files for ckantools 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ckantools-0.6.0.tar.gz | 24.8 kB | Without provenance | Details for ckantools-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ckantools-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for ckantools-0.6.0-py3-none-any.whl |
Total release size: 51.7 kB
Release files / ckantools-0.6.0.tar.gz
| Download URL | ckantools-0.6.0.tar.gz |
|---|---|
| Size | 24.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fba60828190a80de37794ad24b77f733e34e4e4f467316f1c835823007740b54
|
|
BLAKE2b-256 checksum How to use checksums |
452d095897d65c3d6f04fa243a8aaa29a3606a0fa251b005f112939205227323
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / ckantools-0.6.0-py3-none-any.whl
| Download URL | ckantools-0.6.0-py3-none-any.whl |
|---|---|
| Size | 26.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c18740fe4239e8711bf41d0511c4658bb97f4dfe885f1ecf777b4797d4780b87
|
|
BLAKE2b-256 checksum How to use checksums |
a7bfd31415a79189f5f343fa97bb3550d8351ff11b6795c0296849590f15fb0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for ckantools 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.