This is a template for NHM CKAN extensions.
Other relevant tools:
- ruff (linter and formatter)
- docformatter (docstring formatter)
To create a new extension using this template:
git clonethis repo somewhere sensible (e.g.~/.biscuits)cdto the directory you'd like to make the new extension in (e.g./path/to/ckan/src/)cookiecutter ~/.biscuits/cookiecutter-ckanext
You might also be able to use cookiecutter gh:NaturalHistoryMuseum/cookiecutter-ckanext (without having to clone anything).
Once created, init the git repo and install the pre-commit hooks:
git init
pre-commit installTo make a commit:
git add . # or whatever
cz cThe pre-commit hooks will be run automatically. If they fail you can use cz c --retry.
To run all the pre-commit hooks manually on all files:
pre-commit run --all-filesTo run a single hook manually (e.g. ruff formatter) on all files:
pre-commit run ruff-format --all-filesTo run hooks on only modified files, omit the --all-files.
Don't forget to add the secrets: PERSONAL_ACCESS_TOKEN (create one here) and COVERALLS_REPO_TOKEN (get it from the individual coveralls repo page - here's all the NHM repos).