From fefba23a6c9aeca0add11c912eeaf81e9e5fa240 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Fri, 18 Dec 2020 14:09:02 -0800 Subject: [PATCH] h3-py release v3.7.1 (#175) * bumping version * bump py library versino * drop windows build for a sec * and the wheels * put windows back * updating ilammy/msvc-dev-cmd to see if it fixes the build * update to use new Environment Files https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files * put the windows wheels back in * update ilammy/msvc-dev-cmd in the wheels build * testing 3.9 * try building wheel for mac py3.9 * bumping to 3.9 in a few places * demonstrate failing distance test from #169 * fix for #169 * notes * add PR numbers to changelog * update h3lib badge version --- .github/workflows/tests.yml | 8 ++++---- .github/workflows/wheels.yml | 4 ++-- CHANGELOG.md | 8 ++++++++ dev_notes.md | 12 +++++++++++- makefile | 2 +- readme.md | 2 +- src/h3/_cy/cells.pyx | 5 +++++ src/h3/_version.py | 3 ++- src/h3/api/_api_template.py | 3 +++ src/h3lib | 2 +- tests/test_cells_and_edges.py | 8 ++++++++ 11 files changed, 46 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 60c44848..759934f2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [macos-latest, windows-latest, ubuntu-latest] - python-version: [2.7, 3.5, 3.6, 3.7, 3.8] + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9] exclude: - os: windows-latest python-version: 2.7 @@ -29,14 +29,14 @@ jobs: python-version: "${{ matrix.python-version }}" ## Start Windows stuff - - uses: ilammy/msvc-dev-cmd@v1.3.0 + - uses: ilammy/msvc-dev-cmd@v1.5.0 if: startsWith(matrix.os, 'windows') - name: Set Windows Compiler if: startsWith(matrix.os, 'windows') run: | - echo "::set-env name=CC::cl.exe" - echo "::set-env name=CXX::cl.exe" + echo "CC=cl.exe" >> $GITHUB_ENV + echo "CXX=cl.exe" >> $GITHUB_ENV ## End Windows stuff - name: Install from source diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 5454b8bb..d3d7a5f4 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -31,7 +31,7 @@ jobs: with: python-version: 3.8 - - uses: ilammy/msvc-dev-cmd@v1.3.0 + - uses: ilammy/msvc-dev-cmd@v1.5.0 if: startsWith(matrix.os, 'windows') @@ -52,7 +52,7 @@ jobs: - name: Build Mac if: startsWith(matrix.os, 'mac') env: - CIBW_SKIP: pp* cp39-* + CIBW_SKIP: pp* run: | python -m cibuildwheel --output-dir wheelhouse diff --git a/CHANGELOG.md b/CHANGELOG.md index bc1d95cf..55cbc713 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,14 @@ Because H3-Py is versioned in lockstep with the H3 core library, please avoid adding features or APIs which do not map onto the [H3 core API](https://uber.github.io/h3/#/documentation/api-reference/). +## unreleased + +## [3.7.1] - 2020-12-18 + +- fix for #169: `h3_distance` error reporting (#175) +- build Python 3.9 wheel for Mac (#175) +- bump h3lib version to v3.7.1 (#175) + ## [3.7.0] - 2020-10-02 - Add functions (#171) diff --git a/dev_notes.md b/dev_notes.md index d4c17091..9c402378 100644 --- a/dev_notes.md +++ b/dev_notes.md @@ -32,4 +32,14 @@ git pull cd .. git add h3lib git commit ... -``` \ No newline at end of file +``` + +for a specific version tag: + +```sh +cd src/h3lib +git checkout v3.7.1 # or whatever version tag you'd like +cd .. +git add h3lib +git commit ... +``` diff --git a/makefile b/makefile index 2381b732..3c20b78d 100644 --- a/makefile +++ b/makefile @@ -2,7 +2,7 @@ init: purge git submodule update --init - virtualenv -p python3 env + python -m venv env env/bin/pip install .[all] clear: diff --git a/readme.md b/readme.md index 8e5c671c..4ac93528 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ [![PyPI version](https://badge.fury.io/py/h3.svg)](https://badge.fury.io/py/h3) [![PyPI downloads](https://pypip.in/d/h3/badge.png)](https://pypistats.org/packages/h3) [![conda](https://img.shields.io/conda/vn/conda-forge/h3-py.svg)](https://anaconda.org/conda-forge/h3-py) -[![version](https://img.shields.io/badge/h3-v3.7.0-blue.svg)](https://github.com/uber/h3/releases/tag/v3.7.0) +[![version](https://img.shields.io/badge/h3-v3.7.1-blue.svg)](https://github.com/uber/h3/releases/tag/v3.7.1) [![version](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![Tests](https://github.com/uber/h3-py/workflows/tests/badge.svg)](https://github.com/uber/h3-py/actions) diff --git a/src/h3/_cy/cells.pyx b/src/h3/_cy/cells.pyx index 33f94969..4206b81d 100644 --- a/src/h3/_cy/cells.pyx +++ b/src/h3/_cy/cells.pyx @@ -52,6 +52,11 @@ cpdef int distance(H3int h1, H3int h2) except -1: d = h3lib.h3Distance(h1,h2) + if d < 0: + s = 'Cells are too far apart to compute distance: {} and {}' + s = s.format(hex(h1), hex(h2)) + raise H3ValueError(s) + return d cpdef H3int[:] disk(H3int h, int k): diff --git a/src/h3/_version.py b/src/h3/_version.py index 3217a7ab..cb11f3bb 100644 --- a/src/h3/_version.py +++ b/src/h3/_version.py @@ -1,4 +1,4 @@ -__version__ = '3.7.0' +__version__ = '3.7.1' __description__ = 'Hierarchical hexagonal geospatial indexing system' __url__ = 'https://github.com/uber/h3-py' __license__ = "Apache 2.0 License" @@ -16,6 +16,7 @@ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", "Operating System :: Microsoft :: Windows", diff --git a/src/h3/api/_api_template.py b/src/h3/api/_api_template.py index 32e4e37f..8513f6cf 100644 --- a/src/h3/api/_api_template.py +++ b/src/h3/api/_api_template.py @@ -247,6 +247,9 @@ def h3_distance(h1, h2): path between the cells in the graph formed by connecting adjacent cells. + This function will return an H3ValueError if the + cells are too far apart to compute the distance. + Parameters ---------- h1 : H3Cell diff --git a/src/h3lib b/src/h3lib index c99cad0d..ee292a96 160000 --- a/src/h3lib +++ b/src/h3lib @@ -1 +1 @@ -Subproject commit c99cad0dec4ce7f53561eea562eb3ee768a0a4bd +Subproject commit ee292a96906767162f2f530b46fc2428b2555748 diff --git a/tests/test_cells_and_edges.py b/tests/test_cells_and_edges.py index ebfb56b7..173033ac 100644 --- a/tests/test_cells_and_edges.py +++ b/tests/test_cells_and_edges.py @@ -195,6 +195,14 @@ def test_distance(): assert h3.h3_distance(h, n) == 2 +def test_distance_error(): + h1 = '8353b0fffffffff' + h2 = '835804fffffffff' + + with pytest.raises(H3ValueError): + h3.h3_distance(h1, h2) + + def test_compact(): # lat/lngs for State of Maine