Skip to content

Commit

Permalink
WIP: Starting work on v4, The Sequel (#238)
Browse files Browse the repository at this point in the history
* cimport for h3fake2 doesn't seem to work

* back to where we were

* meh, close to what i was hoping for

* h3fake2 in github actions

* comment out current bindings that consume the h3c v3 library

* don't need the coveragerc file at the moment; clear out c files in /tests

* sdist needs h3fake2

* try CIBW_BEFORE_BUILD to get h3fake2

* need h3fake2 for cibuildwheel tests

* update h3 C library

* comment out most of h3lib.pxd

* calling from v4 c lib works! (tests dont' work yet tho)

* tests shall pass

* starting to move over first few functions

* little steps

* util submodule fully moved over; some hackery with h3fake2 errors

* getting even trickier with h3fake2 errors

* few more simple functions

* geo_to_h3 and h3_to_geo

* grid_distance function

* grid_disk

* parents and kids

* compact/uncompact

* getNumCells

* comment out sdist test temporarily

* commenting out `make_sdist` seems to have turned off the other CI jobs

* no, it was that we're pushing to the dev branch

* keep the sdist job in there, but commented out
  • Loading branch information
ajfriend authored May 19, 2022
1 parent f59a1ea commit 298f17f
Show file tree
Hide file tree
Showing 30 changed files with 813 additions and 1,105 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/coverage-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: coverage-lint

on:
push:
branches: [master]
branches: [master, dev_v4]
pull_request:
branches: [master]
branches: [master, dev_v4]

jobs:
tests:
Expand All @@ -23,6 +23,7 @@ jobs:
- name: Install from source
run: |
pip install --upgrade pip setuptools wheel
pip install git+https:/ajfriend/h3fake2.git
pip install .[all]
- name: Lint
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: tests

on:
push:
branches: [master]
branches: [master, dev_v4]
pull_request:
branches: [master]
branches: [master, dev_v4]

jobs:
tests:
Expand Down Expand Up @@ -44,6 +44,7 @@ jobs:
- name: Install from source
run: |
pip install --upgrade pip setuptools wheel
pip install git+https:/ajfriend/h3fake2.git
pip install .[all]
- name: Tests
Expand Down
63 changes: 34 additions & 29 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: wheels

on:
push:
branches: [master]
branches: [master, dev_v4]
pull_request:
branches: [master]
branches: [master, dev_v4]
types:
# Opened, synchronize, and reopened are the default types
# We add ready_for_review to additionally trigger when converting from draft to non-draft
Expand All @@ -18,33 +18,34 @@ on:
- published

jobs:
make_sdist:
name: SDist
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Make sdist
run: |
pipx run build --sdist
- name: Install from sdist
run: |
pip install --upgrade pip setuptools wheel
cp dist/h3-*.tar.gz h3.tar.gz
pip install h3.tar.gz[all]
- name: Test sdist
run: pytest --cov=h3 --full-trace

- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v3
with:
path: ./dist
# make_sdist:
# name: SDist
# if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v3
# with:
# submodules: recursive

# - name: Make sdist
# run: |
# pipx run build --sdist

# - name: Install from sdist
# run: |
# pip install --upgrade pip setuptools wheel
# pip install git+https:/ajfriend/h3fake2.git
# cp dist/h3-*.tar.gz h3.tar.gz
# pip install h3.tar.gz[all]

# - name: Test sdist
# run: pytest --cov=h3 --full-trace

# - name: Upload artifacts to GitHub
# uses: actions/upload-artifact@v3
# with:
# path: ./dist

make_cibw_v1_wheels:
name: "cibuildwheel v1: ${{ matrix.name }}"
Expand Down Expand Up @@ -74,6 +75,8 @@ jobs:
CIBW_TEST_COMMAND: pytest {project}/tests
CIBW_ARCHS_LINUX: auto aarch64
CIBW_BUILD: ${{ matrix.build }}
CIBW_BEFORE_BUILD: pip install git+https:/ajfriend/h3fake2.git
CIBW_BEFORE_TEST: pip install git+https:/ajfriend/h3fake2.git

- name: Check with Twine
run: |
Expand Down Expand Up @@ -152,6 +155,8 @@ jobs:
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_BUILD: ${{ matrix.build }}
CIBW_SKIP: ${{ matrix.skip }}
CIBW_BEFORE_BUILD: pip install git+https:/ajfriend/h3fake2.git
CIBW_BEFORE_TEST: pip install git+https:/ajfriend/h3fake2.git

- name: Check with Twine
run: |
Expand Down
2 changes: 2 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ init: purge
git submodule update --init
python -m venv env
env/bin/pip install --upgrade pip wheel setuptools
env/bin/pip install git+https:/ajfriend/h3fake2.git
env/bin/pip install .[all]
env/bin/pip install -r requirements.in

Expand All @@ -23,6 +24,7 @@ clear:
-@find . -type d -name '*.egg-info' | xargs rm -r
-@find . -type f -name '*.pyc' | xargs rm -r
-@find . -type d -name '*.ipynb_checkpoints' | xargs rm -r
-@find ./tests -type f -name '*.c' | xargs rm -r

rebuild: clear
env/bin/pip install .[all]
Expand Down
1 change: 0 additions & 1 deletion src/h3/_cy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ add_cython_file(geo)
add_cython_file(cells)
add_cython_file(edges)
add_cython_file(to_multipoly)
add_cython_file(unstable_vect)

# Include pyx and pxd files in distribution for use by Cython API
install(
Expand Down
41 changes: 35 additions & 6 deletions src/h3/_cy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,44 @@
is_pentagon,
get_base_cell,
resolution,
parent,
is_res_class_iii,
distance,
disk,
ring,
parent,
children,
center_child,
compact,
uncompact,
num_hexagons,
)

from h3fake2._cy import (
# is_cell,
# is_pentagon,
# get_base_cell,
# resolution,
# parent,
# distance,
# disk,
ring,
# children,
# compact,
# uncompact,
# num_hexagons,
mean_hex_area,
cell_area,
line,
is_res_class_iii,
# is_res_class_iii,
get_pentagon_indexes,
get_res0_indexes,
center_child,
# center_child,
get_faces,
experimental_h3_to_local_ij,
experimental_local_ij_to_h3,
)

from .edges import (
# from .edges import (
from h3fake2._cy import (
are_neighbors,
edge,
is_edge,
Expand All @@ -53,6 +70,17 @@
from .geo import (
geo_to_h3,
h3_to_geo,
# polyfill_polygon,
# polyfill_geojson,
# polyfill,
# cell_boundary,
# edge_boundary,
# point_dist,
)

from h3fake2._cy import (
# geo_to_h3,
# h3_to_geo,
polyfill_polygon,
polyfill_geojson,
polyfill,
Expand All @@ -61,7 +89,8 @@
point_dist,
)

from .to_multipoly import (
# from .to_multipoly import (
from h3fake2._cy import (
h3_set_to_multi_polygon
)

Expand Down
20 changes: 10 additions & 10 deletions src/h3/_cy/cells.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ cpdef int get_base_cell(H3int h) except -1
cpdef int resolution(H3int h) except -1
cpdef int distance(H3int h1, H3int h2) except -1
cpdef H3int[:] disk(H3int h, int k)
cpdef H3int[:] _ring_fallback(H3int h, int k)
cpdef H3int[:] ring(H3int h, int k)
# cpdef H3int[:] _ring_fallback(H3int h, int k)
# cpdef H3int[:] ring(H3int h, int k)
cpdef H3int parent(H3int h, res=*) except 0
cpdef H3int[:] children(H3int h, res=*)
cpdef H3int center_child(H3int h, res=*) except 0
cpdef H3int[:] compact(const H3int[:] hu)
cpdef H3int[:] uncompact(const H3int[:] hc, int res)
cpdef int64_t num_hexagons(int resolution) except -1
cpdef double mean_hex_area(int resolution, unit=*) except -1
cpdef double cell_area(H3int h, unit=*) except -1
cpdef H3int[:] line(H3int start, H3int end)
# cpdef double mean_hex_area(int resolution, unit=*) except -1
# cpdef double cell_area(H3int h, unit=*) except -1
# cpdef H3int[:] line(H3int start, H3int end)
cpdef bool is_res_class_iii(H3int h)
cpdef H3int[:] get_pentagon_indexes(int res)
cpdef H3int[:] get_res0_indexes()
cpdef get_faces(H3int h)
cpdef (int, int) experimental_h3_to_local_ij(H3int origin, H3int h) except *
cpdef H3int experimental_local_ij_to_h3(H3int origin, int i, int j) except 0
# cpdef H3int[:] get_pentagon_indexes(int res)
# cpdef H3int[:] get_res0_indexes()
# cpdef get_faces(H3int h)
# cpdef (int, int) experimental_h3_to_local_ij(H3int origin, H3int h) except *
# cpdef H3int experimental_local_ij_to_h3(H3int origin, int i, int j) except 0
Loading

0 comments on commit 298f17f

Please sign in to comment.