Skip to content

Commit 9b34862

Browse files
authored
Merge pull request #1 from JiscSD/create_map_view
New extension to allow map view for CKAN dataset
2 parents 6a56aed + eaa0de1 commit 9b34862

37 files changed

+29412
-3
lines changed

.coveragerc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[report]
2+
omit =
3+
*/site-packages/*
4+
*/python?.?/*
5+
ckan/*

.github/workflows/test.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Tests
2+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
container:
7+
# The CKAN version tag of the Solr and Postgres containers should match
8+
# the one of the container the tests run on.
9+
# You can switch this base image with a custom image tailored to your project
10+
image: openknowledge/ckan-dev:2.9
11+
services:
12+
solr:
13+
image: ckan/ckan-solr-dev:2.9
14+
postgres:
15+
image: ckan/ckan-postgres-dev:2.9
16+
env:
17+
POSTGRES_USER: postgres
18+
POSTGRES_PASSWORD: postgres
19+
POSTGRES_DB: postgres
20+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
21+
redis:
22+
image: redis:3
23+
24+
env:
25+
CKAN_SQLALCHEMY_URL: postgresql://ckan_default:pass@postgres/ckan_test
26+
CKAN_DATASTORE_WRITE_URL: postgresql://datastore_write:pass@postgres/datastore_test
27+
CKAN_DATASTORE_READ_URL: postgresql://datastore_read:pass@postgres/datastore_test
28+
CKAN_SOLR_URL: http://solr:8983/solr/ckan
29+
CKAN_REDIS_URL: redis://redis:6379/1
30+
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Install requirements
34+
# Install any extra requirements your extension has here (dev requirements, other extensions etc)
35+
run: |
36+
pip install -r requirements.txt
37+
pip install -r dev-requirements.txt
38+
pip install -e .
39+
- name: Setup extension
40+
# Extra initialization steps
41+
run: |
42+
# Replace default path to CKAN core config file with the one on the container
43+
sed -i -e 's/use = config:.*/use = config:\/srv\/app\/src\/ckan\/test-core.ini/' test.ini
44+
45+
ckan -c test.ini db init
46+
- name: Run tests
47+
run: pytest --ckan-ini=test.ini --cov=ckanext.dataset_geo_display --disable-warnings ckanext/dataset_geo_display
48+

.gitignore

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.ropeproject
2+
node_modules
3+
bower_components
4+
5+
# Byte-compiled / optimized / DLL files
6+
__pycache__/
7+
*.py[cod]
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
env/
15+
build/
16+
develop-eggs/
17+
dist/
18+
sdist/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
23+
# PyInstaller
24+
# Usually these files are written by a python script from a template
25+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
26+
*.manifest
27+
*.spec
28+
29+
# Installer logs
30+
pip-log.txt
31+
pip-delete-this-directory.txt
32+
33+
# Unit test / coverage reports
34+
htmlcov/
35+
.tox/
36+
.coverage
37+
.cache
38+
nosetests.xml
39+
coverage.xml
40+
41+
# Sphinx documentation
42+
docs/_build/

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 JiscSD
3+
Copyright (c) 2022 Jisc
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

MANIFEST.in

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include README.rst
2+
include LICENSE
3+
include requirements.txt
4+
recursive-include ckanext/dataset_geo_display *.html *.json *.js *.less *.css *.mo *.yml
5+
recursive-include ckanext/dataset_geo_display/migration *.ini *.py *.mako

README.md

+111-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,112 @@
1+
[![Tests](https://github.com/JiscSD/ckanext-dataset_geo_display/workflows/Tests/badge.svg?branch=main)](https://github.com/JiscSD/ckanext-dataset_geo_display/actions)
2+
13
# ckanext-dataset_geo_display
2-
A CKAN extension to all map display based on the dataset wkt data
4+
5+
This is a CKAN extension that works to help placing the map display for datasets to illustrate the geography coverage of the dataset.
6+
7+
It is currently using hosted version of leaflet
8+
9+
10+
## Requirements
11+
12+
This plugin is developed and tested on CKAN version 2.9
13+
14+
Compatibility with core CKAN versions:
15+
16+
| CKAN version | Compatible? |
17+
| --------------- | ------------- |
18+
| 2.6 and earlier | no |
19+
| 2.7 | no |
20+
| 2.8 | not tested |
21+
| 2.9 | yes |
22+
23+
## Installation
24+
25+
To install dataset_geo_display:
26+
27+
1. Activate your CKAN virtual environment, for example:
28+
```
29+
. /usr/lib/ckan/default/bin/activate
30+
```
31+
2. Clone the source and install it on the virtualenv
32+
33+
(make sure the pip here is using the CKAN virtual environment pip, instead of the system pip)
34+
35+
(to ensure the pip, one can specifically denoted the pip by using the pip under ckan folder)
36+
37+
```
38+
git clone https://github.com/JiscSD/ckanext-dataset_geo_display.git
39+
cd ckanext-dataset_geo_display
40+
pip install -e .
41+
pip install -r requirements.txt
42+
```
43+
3. Add `dataset_geo_display` to the `ckan.plugins` setting in your CKAN
44+
config file (by default the config file is located at
45+
`/etc/ckan/default/ckan.ini`).
46+
47+
4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
48+
```
49+
sudo service apache2 reload
50+
```
51+
or if the server is on AWS, called
52+
```
53+
sudo reboot now
54+
```
55+
56+
## Dependency
57+
58+
The extension requires python library [geomet](https://github.com/geomet/geomet), and js library [leaflet](https://leafletjs.com/index.html).
59+
60+
## Developer installation
61+
62+
To install ckanext-dataset_geo_display for development, activate your CKAN virtualenv and
63+
do:
64+
```
65+
git clone https://github.com/JiscSD/ckanext-dataset_geo_display.git
66+
cd dataset_geo_display
67+
python setup.py develop
68+
pip install -r dev-requirements.txt
69+
```
70+
71+
## Tests
72+
73+
To run the tests, do:
74+
```
75+
pytest --ckan-ini=test.ini
76+
```
77+
78+
## Releasing a new version of dataset_geo_display
79+
80+
If dataset_geo_display should be available on PyPI you can follow these steps to publish a new version:
81+
82+
1. Update the version number in the `setup.py` file. See [PEP 440](http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers) for how to choose version numbers.
83+
84+
2. Make sure you have the latest version of necessary packages:
85+
```
86+
pip install --upgrade setuptools wheel twine
87+
```
88+
3. Create a source and binary distributions of the new version:
89+
```
90+
python setup.py sdist bdist_wheel && twine check dist/*
91+
```
92+
Fix any errors you get.
93+
94+
4. Upload the source distribution to PyPI:
95+
```
96+
twine upload dist/*
97+
```
98+
5. Commit any outstanding changes:
99+
```
100+
git commit -a
101+
git push
102+
```
103+
6. Tag the new release of the project on GitHub with the version number from
104+
the `setup.py` file. For example if the version number in `setup.py` is
105+
0.0.1 then do:
106+
```
107+
git tag 0.0.1
108+
git push --tags
109+
```
110+
## License
111+
112+
[MIT](https://opensource.org/licenses/MIT)

ckanext/__init__.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# encoding: utf-8
2+
3+
# this is a namespace package
4+
try:
5+
import pkg_resources
6+
pkg_resources.declare_namespace(__name__)
7+
except ImportError:
8+
import pkgutil
9+
__path__ = pkgutil.extend_path(__path__, __name__)

ckanext/dataset_geo_display/__init__.py

Whitespace-only changes.
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)