Skip to content

Commit

Permalink
Add support for Python 3.8 (#32)
Browse files Browse the repository at this point in the history
Add support for Python 3.8
  • Loading branch information
hugovk authored Oct 17, 2019
2 parents 9b63de3 + ddfcfc8 commit 2089ae7
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 45 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]

steps:
- uses: actions/checkout@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
- name: Lint
run: tox -e lint
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test

on: [push, pull_request]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.5, 3.6, 3.7]
os: [ubuntu-latest, macOS-latest]

steps:
- uses: actions/checkout@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
python -m pip install -e .
- name: Tox tests
shell: bash
# Drop the dot: py3.7 -> py37
run: |
tox -e py`echo ${{ matrix.python-version }} | tr -d .`
- name: Upload coverage to Codecov
run: |
python -m pip install --upgrade codecov
codecov --name "GH: ${{ matrix.os }} Python ${{ matrix.python-version }}"
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
22 changes: 19 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v1.24.1
hooks:
- id: pyupgrade

- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: black
language_version: python3.7
exclude: ^html/
# override until resolved: https://github.com/psf/black/issues/402
files: \.pyi?$
Expand All @@ -13,10 +17,22 @@ repos:
rev: 3.7.8
hooks:
- id: flake8
language_version: python3.7
additional_dependencies: [flake8-2020]
exclude: ^html/

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.4.1
hooks:
- id: python-check-blanket-noqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml

- repo: https://github.com/mgedmin/check-manifest
rev: "0.39"
rev: '0.40'
hooks:
- id: check-manifest
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
dist: xenial
language: python
cache: pip
cache:
pip: true
directories:
- $HOME/.cache/pre-commit

# Supported CPython versions:
# https://en.wikipedia.org/wiki/CPython#Version_history
Expand All @@ -10,10 +12,10 @@ matrix:
- python: '3.7'
env: TOXENV=lint
- python: "pypy3"
- python: '3.8'
- python: '3.7'
- python: '3.6'
- python: '3.5'
- python: '3.8-dev'

install:
- pip install -U pip
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# OSMViz

[![PyPI version](https://img.shields.io/pypi/v/osmviz.svg)](https://pypi.python.org/pypi/osmviz/)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/osmviz.svg)](https://pypi.python.org/pypi/osmviz/)
[![Build Status](https://travis-ci.org/hugovk/osmviz.svg?branch=master)](https://travis-ci.org/hugovk/osmviz)
[![PyPI version](https://img.shields.io/pypi/v/osmviz.svg?logo=pypi&logoColor=FFE873)](https://pypi.python.org/pypi/osmviz/)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/osmviz.svg?logo=python&logoColor=FFE873)](https://pypi.python.org/pypi/osmviz/)
[![PyPI downloads](https://img.shields.io/pypi/dm/osmviz.svg)](https://pypistats.org/packages/pypistats)
[![Travis CI status](https://img.shields.io/travis/hugovk/osmviz/master?label=Travis%20CI&logo=travis)](https://travis-ci.org/hugovk/osmviz)
[![GitHub Actions status](https://github.com/hugovk/osmviz/workflows/Test/badge.svg)](https://github.com/hugovk/osmviz/actions)
[![codecov](https://codecov.io/gh/hugovk/osmviz/branch/master/graph/badge.svg)](https://codecov.io/gh/hugovk/osmviz)
[![GitHub](https://img.shields.io/github/license/hugovk/osmviz.svg)](LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

An OpenStreetMap Visualization Toolkit for Python
Expand Down
5 changes: 2 additions & 3 deletions html/py2html.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Python source parser and colorizer
"""

# Based on the code from JŸrgen Herman, the following changes where made:
# Based on the code from Jürgen Herman, the following changes were made:
#
# Mike Brown <https://skew.org/~mike/>:
# - make script callable as a CGI and a Apache handler for .py files.
Expand All @@ -30,7 +29,7 @@
__version__ = '0.3'
__date__ = '2005-07-04'
__license__ = 'GPL'
__author__ = 'JŸrgen Hermann, Mike Brown, Christopher Arndt'
__author__ = 'Jürgen Hermann, Mike Brown, Christopher Arndt'

#############################################################################
# Python Source Parser (does highlighting)
Expand Down
29 changes: 4 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
import sys

from setuptools import find_packages, setup

if sys.version_info < (3,):
error = """You are running OSMViz 3.0 on Python 2.
OSMViz 3.0 and above are no longer compatible with Python 2.
Make sure you have pip >= 9.0 and setuptools >= 24.2:
$ pip install pip setuptools --upgrade
Your choices:
- Upgrade to Python 3.
- Install an older version of OSMViz:
$ pip install 'osmviz<3.0'
See the following for more up-to-date information:
https://github.com/hugovk/osmviz/issues/18
"""

print(error, file=sys.stderr)
sys.exit(1)

with open("README.md") as f:
long_description = f.read()
Expand All @@ -45,6 +20,7 @@ def local_scheme(version):
long_description_content_type="text/markdown",
use_scm_version={"local_scheme": local_scheme},
setup_requires=["setuptools_scm"],
extras_require={"tests": ["coverage", "pillow", "pytest", "pytest-cov"]},
python_requires=">=3.5",
classifiers=[
# 'Development Status :: 5 - Production/Stable',
Expand All @@ -54,7 +30,10 @@ def local_scheme(version):
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Documentation",
],
keywords="osm openstreetmap tiles visualization",
Expand Down
2 changes: 1 addition & 1 deletion src/osmviz/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def setTime(self, time):
def printTime(self):
hours = int(self.time / 3600)
minutes = int((self.time % 3600) / 60)
seconds = int((self.time % 60))
seconds = int(self.time % 60)
print("%02d:%02d:%02d" % (hours, minutes, seconds))

def getXY(self, lat, lon, bounds, ssize):
Expand Down
9 changes: 2 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
[tox]
envlist =
lint
py{35, 36, 37, 38}
py{35, 36, 37, 38, py3}

[testenv]
deps =
coverage
pillow
pytest
pytest-cov
extras = tests
commands =
{envpython} setup.py --version
coverage erase
Expand All @@ -20,7 +16,6 @@ commands =
# Test at least one version with tqdm
[testenv:py37]
deps =
{[testenv]deps}
tqdm

[testenv:lint]
Expand Down

0 comments on commit 2089ae7

Please sign in to comment.