Theme for Ontario ckan including:
Four directories compose this repository
.. list-table:: Related projects, repositories, branches and CKAN plugins :header-rows: 1
ckan/ckan <https://github.com/ckan/ckan/>
_open-data/ckanext-scheming <https://github.com/open-data/ckanext-scheming>
_scheming_datasets
open-data/ckanext-fluent <https://github.com/open-data/ckanext-fluent>
_fluent
ckan/ckanext-harvest <https://github.com/ckan/ckanext-harvest>
_harvest
(The harvest extension might not run without adding the following command "sudo mkdir -p /var/log/ckan/std")
ontario_theme
base and internal facing Ontario data catalogueontario_theme_external
customizations for external facing Ontario data catalogue (requires ontario_theme
)ontario_data_catalogue_harvester
harvester for internal data catalogue to sync with the external data catalogue.To install ckanext-ontario_theme for development, activate your CKAN virtualenv and do::
git clone https://github.com/ongov/ckanext-ontario_theme.git
cd ckanext-ontario_theme
python setup.py develop
pip install -r dev-requirements.txt
python setup.py develop
pip install -r dev-requirements.txt
Update the development.ini (or production.ini) plugins::
# This relies on scheming and fluent, make sure these are already installed.
# Note: This extension needs to be before scheming and fluent in the *.ini config file to let the form overrides work.
# For external catalogue
ckan.plugins = [...] ontario_theme_external ontario_theme scheming_datasets scheming_organizations scheming_groups fluent [...]
# For internal catalogue
ckan.plugins = [...] ontario_data_catalogue_harvester ontario_theme harvest scheming_datasets scheming_organizations scheming_groups fluent [...]
# For both, add licenses:
licenses_group_url = file:///<path to this extension>/ckanext/ontario_theme/schemas/licences.json
Setup for CKAN tracking (https://docs.ckan.org/en/2.9/maintaining/tracking.html). The config setting is in the plugin.py
already.
Create a sysadmin user, login and set the HomePage layout under Admin -> Config to the third option. Our homepage uses this layout as it's base.
ontario_data_catalogue_harvester - only for use on the internal catalogue. add the plugin in the ini file and restart the server. visit /harvest and add a harvester for the url https://data.ontario.ca
Follow the CKAN style rules <http://docs.ckan.org/en/latest/contributing/css.html#formatting>
_.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Installing dev-tools and pre-commit hooks for development ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Activate your CKAN virtualenv and run: :: pip install -r dev-requirements.txt pre-commit install
We use the djLint pre-commit hook to lint our code.
To format staged code manually, run the following in your CKAN virtualenv: :: pre-commit run --hook-stage manual format
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Adding ODC recommended settings to your vscode ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ For our CSS formatting, we are using the vscode CSS formatter.
settings.json
in the .vscode
foldersettings.json.default
into the settings.json
file. Save.We have recommendations for vscode extensions in the extensions.json
file of the .vscode
folder.
On start up, a pop up will appear asking if you would like to install the extensions.
The extensions are to make development easier within this repo, they are:
::
Current Process:
python setup.py compile_catalog
from the ckanext-ontario_theme
directoryInitial Creation:
python setup.py extract_messages
) and we generated the .po file for our locale as well (python setup.py init_catalog -l fr
). Some tweaks were made for formatting large strings and removing things that are covered by the CKAN .po files (e.g. "Dataset" is already translated).Additional Info:
msgid
and the empty msgstr
.To run the tests, make sure your ckan install is setup for tests <https://docs.ckan.org/en/latest/contributing/test.html>
_, do::
cd ckanext-ontario_theme # go to extension directory
pytest --ckan-ini=test.ini ckanext/ontario_theme/tests/
To run the tests and produce a coverage report, first make sure you have
coverage installed in your virtualenv (pip install coverage
) then run::
coverage run -m pytest --ckan-ini=test.ini ckanext/ontario_theme/tests/
You can then run::
coverage html
or::
coverage report
You can then find the coverage reports in a generated htmlcov folder.
Our custom config settings are in ./test.ini
.
Running a single test:
Single Test class::
coverage run -m pytest --ckan-ini=test.ini ckanext/ontario_theme/tests/test_create_dataset.py::test_package_create_with_invalid_update_frequency
Single Test module::
coverage run -m pytest --ckan-ini=test.ini ckanext/ontario_theme/tests/test_create_dataset.py