Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint, formatting and test updates #33

Merged
merged 1 commit into from
Dec 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,40 @@ on: [push, pull_request]

jobs:
build:

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

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v1

- 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
with:
path: ~/.cache/pre-commit
key:
${{ matrix.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ matrix.os }}-pre-commit-

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ 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
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox

- name: Lint
run: tox -e lint
- name: Lint
run: tox -e lint
77 changes: 49 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,57 @@ on: [push, pull_request]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.5, 3.6, 3.7]
os: [ubuntu-latest, macOS-latest]
python-version: ["3.6", "3.7", "3.8"]
os: [ubuntu-18.04, ubuntu-16.04, 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 }}
- uses: actions/checkout@v1

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

- name: macOS cache
uses: actions/cache@v1
if: startsWith(matrix.os, 'macOS')
with:
path: ~/Library/Caches/pip
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

- 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 }}
18 changes: 12 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v1.24.1
rev: v1.25.2
hooks:
- id: pyupgrade

- repo: https://github.com/psf/black
rev: 19.3b0
rev: 19.10b0
hooks:
- id: black
args: ["--target-version", "py35"]
exclude: ^html/
# override until resolved: https://github.com/psf/black/issues/402
files: \.pyi?$
types: []

- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.8
rev: 3.7.9
hooks:
- id: flake8
additional_dependencies: [flake8-2020]
exclude: ^html/

- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort

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

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

- repo: https://github.com/mgedmin/check-manifest
rev: '0.40'
rev: "0.40"
hooks:
- id: check-manifest
16 changes: 7 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ cache:
directories:
- $HOME/.cache/pre-commit

# Supported CPython versions:
# https://en.wikipedia.org/wiki/CPython#Version_history
matrix:
fast_finish: true
include:
- python: '3.7'
- python: "3.7"
env: TOXENV=lint
- python: "pypy3"
- python: '3.8'
- python: '3.7'
- python: '3.6'
- python: '3.5'
- python: "3.8"
- python: "3.7"
- python: "3.6"
- python: "3.5"

install:
- pip install -U pip
Expand All @@ -40,7 +38,7 @@ deploy:
condition: $TOXENV = lint
user: hugovk
password:
secure: "UH2iUwZAhdd7ZBV7jtPAEV58cjSMHKv2NLMC2Dg1q29oHWeRl9UBT6JMckXSoLylCSJs6JS7af8JUhP+5fOGRNA+STT78QTD0Gtw1HmkH0ruDKUgkfWFQmoRCKr7Lihuh3NBYQszZwDV3nWZAIumKwq6BA3NMuyaey68Qvxdrt0="
secure: "UH2iUwZAhdd7ZBV7jtPAEV58cjSMHKv2NLMC2Dg1q29oHWeRl9UBT6JMckXSoLylCSJs6JS7af8JUhP+5fOGRNA+STT78QTD0Gtw1HmkH0ruDKUgkfWFQmoRCKr7Lihuh3NBYQszZwDV3nWZAIumKwq6BA3NMuyaey68Qvxdrt0="
distributions: sdist --format=gztar bdist_wheel
skip_existing: true
- provider: pypi
Expand All @@ -51,6 +49,6 @@ deploy:
condition: $TOXENV = lint
user: hugovk
password:
secure: "UH2iUwZAhdd7ZBV7jtPAEV58cjSMHKv2NLMC2Dg1q29oHWeRl9UBT6JMckXSoLylCSJs6JS7af8JUhP+5fOGRNA+STT78QTD0Gtw1HmkH0ruDKUgkfWFQmoRCKr7Lihuh3NBYQszZwDV3nWZAIumKwq6BA3NMuyaey68Qvxdrt0="
secure: "UH2iUwZAhdd7ZBV7jtPAEV58cjSMHKv2NLMC2Dg1q29oHWeRl9UBT6JMckXSoLylCSJs6JS7af8JUhP+5fOGRNA+STT78QTD0Gtw1HmkH0ruDKUgkfWFQmoRCKr7Lihuh3NBYQszZwDV3nWZAIumKwq6BA3NMuyaey68Qvxdrt0="
distributions: sdist --format=gztar bdist_wheel
skip_existing: true
2 changes: 1 addition & 1 deletion examples/custom_animations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
on the map.
"""

from osmviz.animation import SimViz, TrackingViz, Simulation
import pygame
from osmviz.animation import Simulation, SimViz, TrackingViz

# Our goal is to show a train lassoed to Denver, running around it.

Expand Down
2 changes: 1 addition & 1 deletion examples/multiple_trackvizs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
on a map using TrackingViz objects.
"""

from osmviz.animation import TrackingViz, Simulation
from osmviz.animation import Simulation, TrackingViz

# The goal is to show 10 trains racing eastward across the US.

Expand Down
2 changes: 1 addition & 1 deletion examples/pil_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
of OSM tiles patched together.
"""

from osmviz.manager import PILImageManager, OSMManager
import PIL.Image as Image
from osmviz.manager import OSMManager, PILImageManager

imgr = PILImageManager("RGB")
osm = OSMManager(image_manager=imgr)
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from setuptools import find_packages, setup


with open("README.md") as f:
long_description = f.read()

Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_animation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from osmviz.animation import TrackingViz, Simulation
from osmviz.animation import Simulation, TrackingViz

Inf = float("inf")

Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from osmviz.manager import PILImageManager, OSMManager
import PIL.Image as Image
from osmviz.manager import OSMManager, PILImageManager


def test_pil():
Expand Down