Skip to content

Commit

Permalink
Merge branch 'release/1.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreMiras committed Apr 20, 2020
2 parents 01e6073 + f800b7f commit 5b0902b
Show file tree
Hide file tree
Showing 31 changed files with 827 additions and 411 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PyPI release
on: [push]

jobs:
pypi:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --user --upgrade setuptools wheel
- name: Build
run: |
python setup.py sdist bdist_wheel
python setup_meta.py sdist bdist_wheel
- name: Publish package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}
6 changes: 3 additions & 3 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Garden flower
name: Tests
on: [push, pull_request]

jobs:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
draft: true
- name: Test with pytest
run: |
python3 -m pytest --cov=kivy_garden.mapview --cov-report term --cov-branch tests/
python3 -m pytest tests/
- name: Coveralls
# use this custom action until Coveralls fixes uptream issues
# https://github.com/coverallsapp/github-action/issues/30
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
run: python -m pip install -e .[dev,ci] --extra-index-url https://kivy-garden.github.io/simple/
- name: Test with pytest
run: |
python -m pytest --cov=kivy_garden.mapview --cov-report term --cov-branch tests/
python -m pytest tests/
docs:
runs-on: ubuntu-18.04
Expand Down
11 changes: 0 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,3 @@ install:

script:
- docker run -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix mapview-linux /bin/sh -c 'tox'

# Deploy to PyPI using token set in `PYPI_PASSWORD` environment variable
# https://pypi.org/manage/account/token/
# https://travis-ci.com/github/kivy-garden/mapview/settings
deploy:
provider: pypi
distributions: sdist bdist_wheel
user: "__token__"
on:
tags: true
repo: kivy-garden/mapview
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Change Log

## [Unreleased]

- Fix `Downloader` now checks for HTTP status code, refs #6

## [1.0.2]

- Fix `AttributeError` on `GeoJsonMapLayer.canvas_line`
- Fix `AttributeError` on `GeoJsonMapLayer.canvas_line`, refs #12

## [1.0.1]

Expand Down
18 changes: 2 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,21 @@
# docker run mapview-linux /bin/sh -c 'tox'
# Or for interactive shell:
# docker run -it --rm mapview-linux
# For using the UI from Docker you may need to:
# xhost +local:
FROM ubuntu:18.04

# configure locale
RUN apt -y update -qq > /dev/null && apt install --yes --no-install-recommends \
locales \
&& locale-gen en_US.UTF-8 \
&& apt -y autoremove \
&& apt -y clean \
&& rm -rf /var/lib/apt/lists/*
ENV LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"

# install system dependencies
RUN apt -y update -qq > /dev/null && apt install --yes --no-install-recommends \
build-essential \
git \
lsb-release \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
libssl-dev \
make \
pkg-config \
python3-pip \
python3-setuptools \
tox \
virtualenv \
&& python3 -m pip install --upgrade --no-cache setuptools \
&& apt -y autoremove \
&& apt -y clean \
Expand Down
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Mapview

[![Github Build Status](https://github.com/kivy-garden/mapview/workflows/Garden%20flower/badge.svg)](https://github.com/kivy-garden/mapview/actions)
[![Github Build Status](https://github.com/kivy-garden/mapview/workflows/Tests/badge.svg)](https://github.com/kivy-garden/mapview/actions?query=workflow%3ATests)
[![Build Status](https://travis-ci.com/kivy-garden/mapview.svg?branch=develop)](https://travis-ci.com/kivy-garden/mapview)
[![Coverage Status](https://coveralls.io/repos/github/kivy-garden/mapview/badge.svg?branch=develop)](https://coveralls.io/github/kivy-garden/mapview?branch=develop)
[![PyPI version](https://badge.fury.io/py/mapview.svg)](https://badge.fury.io/py/mapview)

Mapview is a Kivy widget for displaying interactive maps. It has been
designed with lot of inspirations of
Expand Down Expand Up @@ -31,13 +32,7 @@ the latests state-of-the-art Kivy's methods.

# Requirements

It requires the `concurrent.futures` and `requests`. If you are on python 2.7,
you can use `futures`:

```
pip install futures requests
```

It requires the `concurrent.futures` and `requests`.
If you use it on Android / iOS, don't forget to add `openssl` as a requirements,
otherwise you'll have an issue when importing `urllib3` from `requests`.

Expand All @@ -64,7 +59,9 @@ class MapViewApp(App):
MapViewApp().run()
```

More extensive documentation will come soon.
Find out more:
- [examples/](https://github.com/kivy-garden/mapview/tree/master/examples)
- <https://mapview.readthedocs.io/en/latest/>


Contributing
Expand Down
15 changes: 5 additions & 10 deletions examples/clustered_geojson.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
from kivy.base import runTouchApp
import sys

if __name__ == '__main__' and __package__ is None:
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from kivy.base import runTouchApp

from kivy_garden.mapview import MapView, MapMarker
from kivy_garden.mapview.geojson import GeoJsonMapLayer
from kivy_garden.mapview import MapMarker, MapView
from kivy_garden.mapview.clustered_marker_layer import ClusteredMarkerLayer
from kivy_garden.mapview.utils import haversine, get_zoom_for_radius
from kivy_garden.mapview.geojson import GeoJsonMapLayer
from kivy_garden.mapview.utils import get_zoom_for_radius, haversine

source = sys.argv[1]

Expand All @@ -27,9 +24,7 @@
view = MapView(**options)
view.add_layer(layer)

marker_layer = ClusteredMarkerLayer(
cluster_radius=200
)
marker_layer = ClusteredMarkerLayer(cluster_radius=200)
view.add_layer(marker_layer)

# create marker if they exists
Expand Down
7 changes: 5 additions & 2 deletions examples/map_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

if __name__ == '__main__' and __package__ is None:
from os import sys, path

sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))

root = Builder.load_string("""
root = Builder.load_string(
"""
#:import MapSource kivy_garden.mapview.MapSource
<Toolbar@BoxLayout>:
Expand Down Expand Up @@ -69,6 +71,7 @@
text: "Longitude: {}".format(mapview.lon)
Label:
text: "Latitude: {}".format(mapview.lat)
""")
"""
)

runTouchApp(root)
8 changes: 6 additions & 2 deletions examples/map_with_marker_popup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import sys

from kivy.base import runTouchApp
from kivy.lang import Builder

if __name__ == '__main__' and __package__ is None:
from os import path

sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))


root = Builder.load_string("""
root = Builder.load_string(
"""
#:import sys sys
#:import MapSource kivy_garden.mapview.MapSource
MapView:
Expand All @@ -33,6 +36,7 @@
markup: True
halign: "center"
""")
"""
)

runTouchApp(root)
9 changes: 3 additions & 6 deletions examples/simple_geojson.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from kivy.base import runTouchApp
import sys

if __name__ == '__main__' and __package__ is None:
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from kivy.base import runTouchApp

from kivy_garden.mapview import MapView, MapMarker
from kivy_garden.mapview import MapMarker, MapView
from kivy_garden.mapview.geojson import GeoJsonMapLayer
from kivy_garden.mapview.utils import haversine, get_zoom_for_radius
from kivy_garden.mapview.utils import get_zoom_for_radius, haversine

if len(sys.argv) > 1:
source = sys.argv[1]
Expand Down
7 changes: 2 additions & 5 deletions examples/simple_map.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import sys
from kivy.base import runTouchApp

if __name__ == '__main__' and __package__ is None:
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from kivy.base import runTouchApp

from kivy_garden.mapview import MapView, MapSource
from kivy_garden.mapview import MapSource, MapView

kwargs = {}
if len(sys.argv) > 1:
Expand Down
18 changes: 9 additions & 9 deletions examples/simple_mbtiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
"""

import sys

from kivy.base import runTouchApp

if __name__ == '__main__' and __package__ is None:
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from kivy_garden.mapview import MapView
from kivy_garden.mapview.mbtsource import MBTilesMapSource


source = MBTilesMapSource(sys.argv[1])
runTouchApp(MapView(
map_source=source,
lat=source.default_lat,
lon=source.default_lon,
zoom=source.default_zoom))
runTouchApp(
MapView(
map_source=source,
lat=source.default_lat,
lon=source.default_lon,
zoom=source.default_zoom,
)
)
11 changes: 6 additions & 5 deletions examples/test_kdbush.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
the selected red dot.
"""

from random import random

from kivy.app import App
from kivy.graphics import Canvas, Color, Ellipse, Rectangle
from kivy.uix.widget import Widget
from kivy.graphics import Color, Rectangle, Ellipse, Canvas

from kivy_garden.mapview.clustered_marker_layer import KDBush, Marker
from random import random

# creating markers
points = []
Expand All @@ -36,8 +38,7 @@ def build(self):
with self.canvas_points:
Color(1, 0, 0)
for marker in points:
Rectangle(
pos=(marker.x * 600, marker.y * 600), size=(2, 2))
Rectangle(pos=(marker.x * 600, marker.y * 600), size=(2, 2))

self.canvas.before.clear()
with self.canvas.before:
Expand Down Expand Up @@ -66,7 +67,7 @@ def on_touch_move(self, touch):

def select(self, x, y):
self.selection_center = (x, y)
self.selection = kdbush.within(x / 600., y / 600., self.radius)
self.selection = kdbush.within(x / 600.0, y / 600.0, self.radius)
self.build()


Expand Down
41 changes: 19 additions & 22 deletions kivy_garden/mapview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,23 @@
MapView is a Kivy widget that display maps.
"""

__all__ = ["Coordinate", "Bbox", "MapView", "MapSource", "MapMarker",
"MapLayer", "MarkerMapLayer", "MapMarkerPopup"]
__version__ = "0.2"

MIN_LATITUDE = -90.
MAX_LATITUDE = 90.
MIN_LONGITUDE = -180.
MAX_LONGITUDE = 180.
CACHE_DIR = "cache"

try:
# fix if used within garden
import sys
sys.modules['mapview'] = sys.modules['kivy.garden.mapview.mapview']
del sys
except KeyError:
pass

from kivy_garden.mapview.types import Coordinate, Bbox
from kivy_garden.mapview.source import MapSource
from kivy_garden.mapview.view import MapView, MapMarker, MapLayer, MarkerMapLayer, \
MapMarkerPopup
from kivy_garden.mapview.types import Bbox, Coordinate
from kivy_garden.mapview.view import (
MapLayer,
MapMarker,
MapMarkerPopup,
MapView,
MarkerMapLayer,
)

__all__ = [
"Coordinate",
"Bbox",
"MapView",
"MapSource",
"MapMarker",
"MapLayer",
"MarkerMapLayer",
"MapMarkerPopup",
]
2 changes: 1 addition & 1 deletion kivy_garden/mapview/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.2'
__version__ = "1.0.3"
Loading

0 comments on commit 5b0902b

Please sign in to comment.