Skip to content

Commit

Permalink
Add multiple python versions to CI (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
robolyst authored Jun 13, 2023
1 parent 38d8499 commit 6945481
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ jobs:
run_tests:
name: Style checks and test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: make deps
- name: Install dependencies - Python ${{ matrix.python-version }}
run: PYTHON_VERSION=${{ matrix.python-version }} make deps
- name: Lint
run: make check
- name: Test
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DEPS := $(VENV)/.deps
PROJECT := streetview
PROJECT_DIR = $(PWD)/$(PROJECT)
TEST_DIR = $(PWD)/tests
PYTHON_VERSION ?= 3.11
PYTHON_CMD := PYTHONPATH=$(PWD) $(VENV)/bin/python
COVERAGE := 90 # Required code coverage

Expand All @@ -31,6 +32,7 @@ $(DEPS): environment.yml $(MAMBA)
echo "Installing dependencies..."
rm -rf $(VENV)
$(MAMBA) create --quiet --yes -p $(VENV)
$(MAMBA) install --quiet --yes --log-level 4 -p $(VENV) python=$(PYTHON_VERSION) -c conda-forge
$(MAMBA) install --quiet --yes --log-level 4 -p $(VENV) -f environment.yml
cp environment.yml $(DEPS)

Expand Down
15 changes: 7 additions & 8 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ channels:
- defaults

dependencies:
- python=3.11.3
- requests
- pillow
- pydantic

# Testing dependencies
- pytest=7.3.1
- pytest-cov==4.0.0
- pytest-vcr==1.0.2
- isort==5.12.0
- black==23.3.0
- flake8==6.0.0
- mypy==1.2.0
- pytest
- pytest-cov
- pytest-vcr
- isort
- black
- flake8
- mypy
- types-requests
- types-Pillow
- build
Expand Down
3 changes: 2 additions & 1 deletion streetview/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from io import BytesIO
from typing import Dict, Union

import requests
from PIL import Image
Expand Down Expand Up @@ -62,7 +63,7 @@ def get_streetview(
"""

url = "https://maps.googleapis.com/maps/api/streetview"
params: dict[str, str | int] = {
params: Dict[str, Union[str, int]] = {
"size": "%dx%d" % (width, height),
"fov": fov,
"pitch": pitch,
Expand Down
7 changes: 4 additions & 3 deletions streetview/search.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import re
from typing import List, Optional

import requests
from pydantic import BaseModel
Expand All @@ -13,7 +14,7 @@ class Panorama(BaseModel):
heading: float
pitch: float
roll: float
date: str | None
date: Optional[str]


def make_search_url(lat: float, lon: float) -> str:
Expand Down Expand Up @@ -41,7 +42,7 @@ def search_request(lat: float, lon: float) -> Response:
return requests.get(url)


def extract_panoramas(text: str) -> list[Panorama]:
def extract_panoramas(text: str) -> List[Panorama]:
"""
Given a valid response from the panoids endpoint, return a list of all the
panoids.
Expand Down Expand Up @@ -86,7 +87,7 @@ def extract_panoramas(text: str) -> list[Panorama]:
]


def search_panoramas(lat: float, lon: float) -> list[Panorama]:
def search_panoramas(lat: float, lon: float) -> List[Panorama]:
"""
Gets the closest panoramas (ids) to the GPS coordinates.
"""
Expand Down

0 comments on commit 6945481

Please sign in to comment.