Skip to content

Commit

Permalink
Merge pull request #38 from hugovk/add-3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Oct 9, 2020
2 parents 4c1de59 + 08e73fd commit 4f70fd0
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 103 deletions.
41 changes: 19 additions & 22 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,39 @@ name: Lint

on: [push, pull_request]

env:
FORCE_COLOR: 1

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ matrix.os }}-pip-
- name: pre-commit cache
uses: actions/cache@v1
- name: Cache
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
path: |
~/.cache/pip
~/.cache/pre-commit
key:
${{ matrix.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
lint-v1-${{ hashFiles('**/setup.py') }}-${{
hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ matrix.os }}-pre-commit-
lint-v1-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
python -m pip install -U pip
python -m pip install -U tox
- name: Lint
run: tox -e lint
env:
PRE_COMMIT_COLOR: always
64 changes: 30 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,63 @@ name: Test

on: [push, pull_request]

env:
FORCE_COLOR: 1

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8"]
os: [ubuntu-18.04, ubuntu-16.04, macos-latest]
python-version: ["3.6", "3.7", "3.8", "3.9"]
os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, macos-latest]
include:
# Include new variables for Codecov
- os: ubuntu-18.04
codecov-flag: GHA_Ubuntu_18
- os: ubuntu-16.04
codecov-flag: GHA_Ubuntu_16
- os: macos-latest
codecov-flag: GHA_macOS
- { codecov-flag: GHA_Ubuntu_20, os: ubuntu-20.04 }
- { codecov-flag: GHA_Ubuntu_18, os: ubuntu-18.04 }
- { codecov-flag: GHA_Ubuntu_16, os: ubuntu-16.04 }
- { codecov-flag: GHA_macOS, os: macos-latest }
exclude:
# Pending Pillow 8.0.0 (~2020-10-15)
- { python-version: "3.9", os: macos-latest }

steps:
- uses: actions/checkout@v2

- name: Ubuntu cache
uses: actions/cache@v1
if: startsWith(matrix.os, 'ubuntu')
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
path: ~/.cache/pip
key:
${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')
}}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-
python-version: ${{ matrix.python-version }}

- name: macOS cache
uses: actions/cache@v1
if: startsWith(matrix.os, 'macOS')
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ~/Library/Caches/pip
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')
}}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-
- 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 -U pip
python -m pip install -U wheel
python -m pip install -U tox
- name: Tox tests
shell: bash
run: |
tox -e py
- name: Upload coverage
if: success()
run: |
curl -s https://codecov.io/bash -o codecov.sh
bash codecov.sh -F ${{ matrix.codecov-flag }}
env:
CODECOV_NAME: ${{ matrix.os }} Python ${{ matrix.python-version }}
uses: codecov/codecov-action@v1
with:
flags: ${{ matrix.codecov-flag }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
26 changes: 16 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v1.26.2
rev: v2.7.2
hooks:
- id: pyupgrade
args: ["--py36-plus"]

- repo: https://github.com/psf/black
rev: 19.10b0
rev: 20.8b1
hooks:
- id: black
args: ["--target-version", "py36"]
Expand All @@ -15,26 +15,32 @@ repos:
files: \.pyi?$
types: []

- repo: https://github.com/PyCQA/isort
rev: 5.6.1
hooks:
- id: isort

- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
rev: 3.8.4
hooks:
- id: flake8
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]
exclude: ^html/

- repo: https://github.com/timothycrosley/isort
rev: 4.3.21
hooks:
- id: isort

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

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

# Skip whilst it strips comments
# - repo: https://github.com/tox-dev/tox-ini-fmt
# rev: 0.5.0
# hooks:
# - id: tox-ini-fmt
1 change: 1 addition & 0 deletions examples/custom_animations.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import pygame

from osmviz.animation import Simulation, SimViz, TrackingViz

# Our goal is to show a train lassoed to Denver, running around it.
Expand Down
1 change: 1 addition & 0 deletions examples/pil_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import PIL.Image as Image

from osmviz.manager import OSMManager, PILImageManager

imgr = PILImageManager("RGB")
Expand Down
3 changes: 2 additions & 1 deletion html/py2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
# as intermediate

import cgi
import cStringIO
import keyword
import string
import sys
import token
import tokenize

import cStringIO

__version__ = '0.3'
__date__ = '2005-07-04'
__license__ = 'GPL'
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def local_scheme(version):
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
Expand Down
29 changes: 0 additions & 29 deletions src/osmviz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,3 @@
# 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.
import sys

if sys.version_info < (3,):
raise ImportError(
"""You are running OSMViz 3.0 on Python 2.
OSMViz 3.0 and above are no longer compatible with Python 2, and you still
ended up with this version installed. That's unfortunate; sorry about that.
It should not have happened. Make sure you have pip >= 9.0 to avoid this kind
of issue, as well as 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'
It would be great if you can figure out how this version ended up being
installed, and try to check how to prevent it for future users.
See the following for more up-to-date information:
https://github.com/hugovk/osmviz/issues/18
"""
)
1 change: 1 addition & 0 deletions test/functional/test_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import PIL.Image as Image

from osmviz.manager import OSMManager, PILImageManager


Expand Down
17 changes: 10 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[tox]
envlist =
lint
py{36, 37, 38, 39, py3}
py{py3, 39, 38, 37, 36}

[testenv]
extras = tests
extras =
tests
commands =
{envpython} setup.py --version
coverage erase
Expand All @@ -14,12 +15,14 @@ commands =
{envpython} -m pytest --cov osmviz --cov test --cov-append test/functional/test_manager.py {posargs}
coverage xml

[testenv:lint]
skip_install = true
deps =
pre-commit
commands =
pre-commit run --all-files

# Test at least one version with tqdm
[testenv:py37]
deps =
tqdm

[testenv:lint]
deps = pre-commit
commands = pre-commit run --all-files
skip_install = true

0 comments on commit 4f70fd0

Please sign in to comment.