diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 3304c20..7a2f3c6 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -11,12 +11,9 @@ jobs: with: python-version: 3.x - name: Install dependencies - run: | - python3 -m pip install --upgrade pip virtualenv wheel setuptools - - name: Lint with pycodestyle - run: | - python3 -m pip install flake8 - python3 -m flake8 . --count --ignore=E125,E126,E127,E128,E402,E741,E731,W503,F401,W504,F841 --show-source --statistics --max-line-length=80 --exclude=__pycache__,.tox,.git/,doc/ + run: python3 -m pip install tox>=2.0 + - name: Linting + run: python3 -m tox -e pep8 linux_test: runs-on: ubuntu-18.04 @@ -58,8 +55,7 @@ jobs: draft: true - name: Test with pytest run: | - flower_name=$(python3 -c "print('$GITHUB_REPOSITORY'.split('/')[-1])") - python3 -m pytest --cov=kivy_garden.$flower_name --cov-report term --cov-branch + python3 -m pytest --cov=kivy_garden.mapview --cov-report term --cov-branch tests/ windows_test: runs-on: windows-latest @@ -79,8 +75,7 @@ jobs: run: python -m pip install -e .[dev,ci] --extra-index-url https://kivy-garden.github.io/simple/ - name: Test with pytest run: | - $flower_name=(python -c "print('$GITHUB_REPOSITORY'.split('/')[-1])") - python -m pytest --cov=kivy_garden.$flower_name --cov-report term --cov-branch + python -m pytest --cov=kivy_garden.mapview --cov-report term --cov-branch tests/ docs: runs-on: ubuntu-18.04 @@ -112,7 +107,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - flower_name=$(python3 -c "print('$GITHUB_REPOSITORY'.split('/')[-1])") cp -r doc/build/html ~/docs_temp git config --global user.email "kivy@kivy.org" @@ -123,9 +117,9 @@ jobs: git checkout --orphan gh-pages cp -r .git ~/docs_git cd .. - rm -rf $flower_name - mkdir $flower_name - cd $flower_name + rm -rf mapview + mkdir mapview + cd mapview cp -r ~/docs_git .git cp -r ~/docs_temp/* . touch .nojekyll diff --git a/.travis.yml b/.travis.yml index d2b04cd..69b0f5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,3 +11,14 @@ 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 diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index f3854b0..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,4 +0,0 @@ -v0.1.0 Initial release -====================== - -Added the demo flower project. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..755a087 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Change Log + +## [1.0.1] + + - Migrate to kivy-garden/mapview + +## [1.0.0] + + - Initial release diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e0c7bf2..0000000 --- a/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Mathieu Virbel - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/README.md b/README.md index 8e4ad84..c12980a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Mapview [![Github Build Status](https://github.com/kivy-garden/mapview/workflows/Garden%20flower/badge.svg)](https://github.com/kivy-garden/mapview/actions) -[![Build Status](https://travis-ci.com/kivy-garden/garden.mapview.svg?branch=master)](https://travis-ci.com/kivy-garden/garden.mapview) +[![Build Status](https://travis-ci.com/kivy-garden/mapview.svg?branch=develop)](https://travis-ci.com/kivy-garden/mapview) Mapview is a Kivy widget for displaying interactive maps. It has been designed with lot of inspirations of @@ -42,10 +42,8 @@ otherwise you'll have an issue when importing `urllib3` from `requests`. # Install -Install the mapview garden module using the `garden` tool: - ``` -garden install mapview +pip install mapview ``` # Usage @@ -54,7 +52,7 @@ This widget can be either used within Python or Kv. That's said, not everything can be done in Kv, to prevent too much computing. ```python -from kivy.garden.mapview import MapView +from kivy_garden.mapview import MapView from kivy.app import App class MapViewApp(App): diff --git a/__init__.py b/__init__.py deleted file mode 100644 index 54edab4..0000000 --- a/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# coding=utf-8 - -from .mapview import * diff --git a/examples/clustered_geojson.py b/examples/clustered_geojson.py index 32aa315..06ecbf1 100644 --- a/examples/clustered_geojson.py +++ b/examples/clustered_geojson.py @@ -5,10 +5,10 @@ from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) -from mapview import MapView, MapMarker -from mapview.geojson import GeoJsonMapLayer -from mapview.clustered_marker_layer import ClusteredMarkerLayer -from mapview.utils import haversine, get_zoom_for_radius +from kivy_garden.mapview import MapView, MapMarker +from kivy_garden.mapview.geojson import GeoJsonMapLayer +from kivy_garden.mapview.clustered_marker_layer import ClusteredMarkerLayer +from kivy_garden.mapview.utils import haversine, get_zoom_for_radius source = sys.argv[1] diff --git a/examples/map_browser.py b/examples/map_browser.py index 4aacb27..f8e5117 100644 --- a/examples/map_browser.py +++ b/examples/map_browser.py @@ -6,7 +6,7 @@ sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) root = Builder.load_string(""" -#:import MapSource mapview.MapSource +#:import MapSource kivy_garden.mapview.MapSource : size_hint_y: None diff --git a/examples/map_with_marker_popup.py b/examples/map_with_marker_popup.py index a7446fd..642c87a 100644 --- a/examples/map_with_marker_popup.py +++ b/examples/map_with_marker_popup.py @@ -6,11 +6,10 @@ from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) -import mapview root = Builder.load_string(""" #:import sys sys -#:import MapSource mapview.MapSource +#:import MapSource kivy_garden.mapview.MapSource MapView: lat: 50.6394 lon: 3.057 diff --git a/examples/simple_geojson.py b/examples/simple_geojson.py index 835c107..29b8a9f 100644 --- a/examples/simple_geojson.py +++ b/examples/simple_geojson.py @@ -5,9 +5,9 @@ from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) -from mapview import MapView, MapMarker -from mapview.geojson import GeoJsonMapLayer -from mapview.utils import haversine, get_zoom_for_radius +from kivy_garden.mapview import MapView, MapMarker +from kivy_garden.mapview.geojson import GeoJsonMapLayer +from kivy_garden.mapview.utils import haversine, get_zoom_for_radius if len(sys.argv) > 1: source = sys.argv[1] diff --git a/examples/simple_map.py b/examples/simple_map.py index f5a4dc6..86256ea 100644 --- a/examples/simple_map.py +++ b/examples/simple_map.py @@ -5,7 +5,7 @@ from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) -from mapview import MapView, MapSource +from kivy_garden.mapview import MapView, MapSource kwargs = {} if len(sys.argv) > 1: diff --git a/examples/simple_mbtiles.py b/examples/simple_mbtiles.py index 05cbad6..be3e364 100644 --- a/examples/simple_mbtiles.py +++ b/examples/simple_mbtiles.py @@ -14,8 +14,8 @@ if __name__ == '__main__' and __package__ is None: from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) -from mapview import MapView -from mapview.mbtsource import MBTilesMapSource +from kivy_garden.mapview import MapView +from kivy_garden.mapview.mbtsource import MBTilesMapSource source = MBTilesMapSource(sys.argv[1]) diff --git a/examples/test_kdbush.py b/examples/test_kdbush.py index d4d305b..89b3cc0 100644 --- a/examples/test_kdbush.py +++ b/examples/test_kdbush.py @@ -8,7 +8,7 @@ from kivy.app import App from kivy.uix.widget import Widget from kivy.graphics import Color, Rectangle, Ellipse, Canvas -from mapview.clustered_marker_layer import KDBush, Marker +from kivy_garden.mapview.clustered_marker_layer import KDBush, Marker from random import random # creating markers diff --git a/mapview/__init__.py b/kivy_garden/mapview/__init__.py similarity index 74% rename from mapview/__init__.py rename to kivy_garden/mapview/__init__.py index 0b4b9a0..19a6280 100644 --- a/mapview/__init__.py +++ b/kivy_garden/mapview/__init__.py @@ -26,7 +26,7 @@ except KeyError: pass -from mapview.types import Coordinate, Bbox -from mapview.source import MapSource -from mapview.view import MapView, MapMarker, MapLayer, MarkerMapLayer, \ +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 diff --git a/kivy_garden/mapview/_version.py b/kivy_garden/mapview/_version.py new file mode 100644 index 0000000..cd7ca49 --- /dev/null +++ b/kivy_garden/mapview/_version.py @@ -0,0 +1 @@ +__version__ = '1.0.1' diff --git a/mapview/clustered_marker_layer.py b/kivy_garden/mapview/clustered_marker_layer.py similarity index 99% rename from mapview/clustered_marker_layer.py rename to kivy_garden/mapview/clustered_marker_layer.py index e270e84..b9c7c2e 100644 --- a/mapview/clustered_marker_layer.py +++ b/kivy_garden/mapview/clustered_marker_layer.py @@ -6,7 +6,7 @@ from os.path import dirname, join from math import sin, log, pi, atan, exp, floor, sqrt -from mapview.view import MapLayer, MapMarker +from kivy_garden.mapview.view import MapLayer, MapMarker from kivy.lang import Builder from kivy.metrics import dp from kivy.properties import (ObjectProperty, NumericProperty, StringProperty, ListProperty) diff --git a/mapview/downloader.py b/kivy_garden/mapview/downloader.py similarity index 99% rename from mapview/downloader.py rename to kivy_garden/mapview/downloader.py index 101413c..e5f887e 100644 --- a/mapview/downloader.py +++ b/kivy_garden/mapview/downloader.py @@ -10,7 +10,7 @@ import requests import traceback from time import time -from mapview import CACHE_DIR +from kivy_garden.mapview import CACHE_DIR DEBUG = "MAPVIEW_DEBUG_DOWNLOADER" in environ diff --git a/mapview/geojson.py b/kivy_garden/mapview/geojson.py similarity index 98% rename from mapview/geojson.py rename to kivy_garden/mapview/geojson.py index 715b185..c99667a 100644 --- a/mapview/geojson.py +++ b/kivy_garden/mapview/geojson.py @@ -27,9 +27,9 @@ from kivy.graphics.tesselator import Tesselator, WINDING_ODD, TYPE_POLYGONS from kivy.utils import get_color_from_hex from kivy.metrics import dp -from mapview import CACHE_DIR -from mapview.view import MapLayer -from mapview.downloader import Downloader +from kivy_garden.mapview import CACHE_DIR +from kivy_garden.mapview.view import MapLayer +from kivy_garden.mapview.downloader import Downloader COLORS = { 'aliceblue': '#f0f8ff', diff --git a/mapview/icons/cluster.png b/kivy_garden/mapview/icons/cluster.png similarity index 100% rename from mapview/icons/cluster.png rename to kivy_garden/mapview/icons/cluster.png diff --git a/mapview/icons/marker.png b/kivy_garden/mapview/icons/marker.png similarity index 100% rename from mapview/icons/marker.png rename to kivy_garden/mapview/icons/marker.png diff --git a/mapview/mbtsource.py b/kivy_garden/mapview/mbtsource.py similarity index 97% rename from mapview/mbtsource.py rename to kivy_garden/mapview/mbtsource.py index 7c771bc..4d8eabb 100644 --- a/mapview/mbtsource.py +++ b/kivy_garden/mapview/mbtsource.py @@ -10,8 +10,8 @@ __all__ = ["MBTilesMapSource"] -from mapview.source import MapSource -from mapview.downloader import Downloader +from kivy_garden.mapview.source import MapSource +from kivy_garden.mapview.downloader import Downloader from kivy.core.image import Image as CoreImage, ImageLoader import threading import sqlite3 diff --git a/mapview/source.py b/kivy_garden/mapview/source.py similarity index 96% rename from mapview/source.py rename to kivy_garden/mapview/source.py index 5ae2ce2..7e6c346 100644 --- a/mapview/source.py +++ b/kivy_garden/mapview/source.py @@ -4,10 +4,10 @@ from kivy.metrics import dp from math import cos, ceil, log, tan, pi, atan, exp -from mapview import MIN_LONGITUDE, MAX_LONGITUDE, MIN_LATITUDE, MAX_LATITUDE, \ +from kivy_garden.mapview import MIN_LONGITUDE, MAX_LONGITUDE, MIN_LATITUDE, MAX_LATITUDE, \ CACHE_DIR -from mapview.downloader import Downloader -from mapview.utils import clamp +from kivy_garden.mapview.downloader import Downloader +from kivy_garden.mapview.utils import clamp import hashlib diff --git a/mapview/types.py b/kivy_garden/mapview/types.py similarity index 100% rename from mapview/types.py rename to kivy_garden/mapview/types.py diff --git a/mapview/utils.py b/kivy_garden/mapview/utils.py similarity index 100% rename from mapview/utils.py rename to kivy_garden/mapview/utils.py diff --git a/mapview/view.py b/kivy_garden/mapview/view.py similarity index 99% rename from mapview/view.py rename to kivy_garden/mapview/view.py index 75e6a4f..b5b3d5c 100644 --- a/mapview/view.py +++ b/kivy_garden/mapview/view.py @@ -18,10 +18,10 @@ from kivy.lang import Builder from kivy.compat import string_types from math import ceil -from mapview import MIN_LONGITUDE, MAX_LONGITUDE, MIN_LATITUDE, MAX_LATITUDE, \ +from kivy_garden.mapview import MIN_LONGITUDE, MAX_LONGITUDE, MIN_LATITUDE, MAX_LATITUDE, \ CACHE_DIR, Coordinate, Bbox -from mapview.source import MapSource -from mapview.utils import clamp +from kivy_garden.mapview.source import MapSource +from kivy_garden.mapview.utils import clamp from itertools import takewhile import webbrowser diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 09ae8ff..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -Kivy-Garden==0.1.1 -futures==2.1.6 -requests==1.2.3 diff --git a/setup.py b/setup.py index 0252208..7a2fbf0 100644 --- a/setup.py +++ b/setup.py @@ -7,8 +7,7 @@ here = path.abspath(path.dirname(__file__)) -filename = path.join(here, 'kivy_garden', 'flower', '_version.py') -# change this ^^^^^^ +filename = path.join(here, 'kivy_garden', 'mapview', '_version.py') locals = {} with open(filename, "rb") as fh: exec(compile(fh.read(), filename, 'exec'), globals(), locals) @@ -17,12 +16,12 @@ with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() -URL = 'https://github.com/kivy-garden/flower' +URL = 'https://github.com/kivy-garden/mapview' -setup( - name='kivy_garden.flower', +setup_params = dict( + name='kivy_garden.mapview', version=__version__, - description='A kivy garden flower demo.', + description='A kivy garden mapview demo.', long_description=long_description, long_description_content_type='text/markdown', url=URL, @@ -43,7 +42,7 @@ packages=find_namespace_packages(include=['kivy_garden.*']), install_requires=[], extras_require={ - 'dev': ['pytest>=3.6', 'pytest-cov', 'pytest-asyncio', + 'dev': ['pytest>=3.6', 'pytest-cov', 'pytest-asyncio', 'flake8', 'sphinx_rtd_theme'], 'ci': ['coveralls', 'pycodestyle'], }, @@ -55,3 +54,12 @@ 'Source': URL, }, ) + + +def run_setup(): + setup(**setup_params) + + +# makes sure the setup doesn't run at import time +if __name__ == "__main__": + run_setup() diff --git a/setup_meta.py b/setup_meta.py new file mode 100644 index 0000000..62eea95 --- /dev/null +++ b/setup_meta.py @@ -0,0 +1,14 @@ +""" +Creates a distribution alias that just installs kivy_garden.mapview. +""" +from setuptools import setup + +from setup import setup_params + +setup_params.update({ + 'install_requires': ['kivy_garden.mapview'], + 'name': 'mapview', +}) + + +setup(**setup_params) diff --git a/tests/test_mapview.py b/tests/test_mapview.py index df710c3..4023003 100644 --- a/tests/test_mapview.py +++ b/tests/test_mapview.py @@ -1,5 +1,5 @@ import unittest -from mapview import MapView +from kivy_garden.mapview import MapView class TextInputTest(unittest.TestCase): diff --git a/tox.ini b/tox.ini index 7c3010d..856acb4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,24 +1,16 @@ [tox] -envlist = pep8,py27,py36 -skipsdist = True -# trick to enable pre-installation of Cython -# https://stackoverflow.com/a/50081741/185510 -indexserver = - preinstall = https://pypi.python.org/simple +envlist = pep8,py36 [testenv] -passenv = DISPLAY XDG_RUNTIME_DIR -basepython = python2.7 -deps = - :preinstall: Cython==0.28.2 - -r{toxinidir}/requirements.txt - kivy +passenv = DISPLAY XDG_RUNTIME_DIR HOME +deps = kivy +extras = dev commands = - python -m unittest discover --top-level-directory=. --start-directory=tests/ + pytest tests/ [testenv:pep8] deps = flake8 -commands = flake8 mapview/ examples/ +commands = flake8 kivy_garden/ examples/ [flake8] ignore =