Skip to content

Commit

Permalink
Merge branch 'release/6.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ddohler committed Jul 20, 2021
2 parents 6f10e4c + 052c825 commit b81cc3a
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 28 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches:
- develop
- master
pull_request:

jobs:
build:
name: build
runs-on: ubuntu-latest
strategy:
matrix:
# TODO: Running the full matrix seems to make the US Census Geocoder
# more likely to return errors; running a single one is more likely
# to succeed. This is disabled temporarily. Tracking issue:
# https://github.com/azavea/python-omgeo/issues/66
# python-version: ["3.6", "3.7", "3.8"]
python-version: ["3.8"]
steps:
- uses: actions/checkout@v2

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

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('setup.cfg') }}-${{ hashFiles('tox.ini') }}
restore-keys: pip-

- name: Install packages
run: pip install flake8

- name: Lint
run: flake8

- name: Run tests
run: python setup.py test
env:
BING_MAPS_API_KEY: ${{ secrets.BING_MAPS_API_KEY }}
ESRI_CLIENT_ID: ${{ secrets.ESRI_CLIENT_ID }}
ESRI_CLIENT_SECRET: ${{ secrets.ESRI_CLIENT_SECRET }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
MAPQUEST_API_KEY: ${{ secrets.MAPQUEST_API_KEY }}
PELIAS_API_KEY: ${{ secrets.PELIAS_API_KEY }}

34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release

on:
push:
tags:
- "*"

jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout commit and fetch tag history
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install release dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish package
env:
TWINE_USERNAME: ${{ secrets.PYPI_AZAVEA_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_AZAVEA_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,9 @@ v6.0.3, 2019-10-14
v6.0.4, 2019-12-19
------------------
* Fix template string error in AttrListIncludes and AttrListExcludes __repr__

v6.1.0, 2021-07-20
------------------
* Populate match_region using RegionAbbr rather than Region from EsriWGS. For
example, when using the EsriWGS geocoder, expect 'PA' rather than
'Pennsylvania' in match_region.
4 changes: 2 additions & 2 deletions omgeo/services/esri.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _geocode(self, pq):
# 'AddBldg',
'City',
'Subregion',
'Region',
'RegionAbbr',
'Postal',
'Country',
# 'Ymax',
Expand Down Expand Up @@ -205,7 +205,7 @@ def _geocode(self, pq):

# Optional address component fields.
for in_key, out_key in [('City', 'match_city'), ('Subregion', 'match_subregion'),
('Region', 'match_region'), ('Postal', 'match_postal'),
('RegionAbbr', 'match_region'), ('Postal', 'match_postal'),
('Country', 'match_country')]:
setattr(c, out_key, attributes.get(in_key, ''))
setattr(c, 'match_streetaddr', self._street_addr_from_response(attributes))
Expand Down
12 changes: 11 additions & 1 deletion omgeo/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def setUp(self):
if MAPQUEST_API_KEY is not None: # MapQuest's open Nominatime API now also requires a key
self.g_nom = Geocoder([['omgeo.services.Nominatim', {}]])

self.g_census = Geocoder([['omgeo.services.USCensus', {}]])
self.g_census = Geocoder([['omgeo.services.USCensus', {'settings': {'timeout': 30}}]])

ESRI_WGS_LOCATOR_MAP = {'PointAddress': 'rooftop',
'StreetAddress': 'interpolation',
Expand Down Expand Up @@ -224,6 +224,16 @@ def test_geocode_esri_wgs_auth(self):
candidates = self.g_esri_wgs_auth.get_candidates(self.pq['azavea'])
self.assertOneCandidate(candidates)

def test_esri_short_region(self):
"""Ensure that Esri uses region abbreviations"""
candidate = self.g_esri_wgs.get_candidates(self.pq["azavea"])[0]
self.assertEqual(candidate.match_region, "PA")

def test_google_short_region(self):
"""Ensure that Google uses region abbreviations"""
candidate = self.g_google.get_candidates(self.pq["azavea"])[0]
self.assertEqual(candidate.match_region, "PA")

@unittest.skipIf(BING_MAPS_API_KEY is None, BING_KEY_REQUIRED_MSG)
def test_geocode_bing(self):
"""Test Azavea's address using Bing geocoder"""
Expand Down

0 comments on commit b81cc3a

Please sign in to comment.