Skip to content

Commit

Permalink
Bunch of CI/CD-related fixes (#796)
Browse files Browse the repository at this point in the history
* updated year in citation

* removed links to old docs site

* added dask dataframe to requirements as test

* added unstable fix for polygonize generated_jit

* added py312 and dropped 3.8 and 3.9

* changed 3.10 back to string

* updated codecov.yml

* updated codecov.yml

* if stat upload fails, still pass test

* added code coverage token
  • Loading branch information
brendancol authored Apr 22, 2024
1 parent 27ab0c8 commit 950ca44
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: [3.9]
python: [3.12]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
Expand All @@ -31,8 +31,9 @@ jobs:
run: |
NUMBA_DISABLE_JIT=1 pytest --cov=./ --cov-report=xml --ignore ./xrspatial/tests/test_polygonize.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON
fail_ci_if_error: true
verbose: true
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python: [3.8, 3.9, '3.10', 3.11]
python: ['3.10', 3.11, 3.12]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
<td>Downloads</td>
<td>
<div>
<a href="https://xarray-spatial.org/getting_started/installation.html">
<img src="https://img.shields.io/pypi/dm/xarray-spatial?label=PyPI"
alt="PyPI downloads per month" />
</a>
</div>
</td>
</tr>
Expand Down Expand Up @@ -123,9 +121,6 @@ In all the above, the command will download and store the files into your curren
`xarray-spatial` does not depend on GDAL / GEOS, which makes it fully extensible in Python but does limit the breadth of operations that can be covered. xarray-spatial is meant to include the core raster-analysis functions needed for GIS developers / analysts, implemented independently of the non-Python geo stack.


Our documentation is still under construction, but [docs can be found here](https://xarray-spatial.org/).


#### Raster-huh?

Rasters are regularly gridded datasets like GeoTIFFs, JPGs, and PNGs.
Expand Down Expand Up @@ -283,4 +278,4 @@ With the introduction of projects like Numba, Python gained new ways to provide
#### Citation
Cite our code:

`makepath/xarray-spatial, https://github.com/makepath/xarray-spatial, ©2020-2023.`
`makepath/xarray-spatial, https://github.com/makepath/xarray-spatial, ©2020-2024.`
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
datashader
dask[dataframe]
noise >=1.2.2
numba
xarray
29 changes: 28 additions & 1 deletion xrspatial/experimental/polygonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,33 @@
_visited_dtype = np.uint8


def generated_jit(function=None, cache=False,
pipeline_class=None, **options):
"""
This decorator allows flexible type-based compilation
of a jitted function. It works as `@jit`, except that the decorated
function is called at compile-time with the *types* of the arguments
and should return an implementation function for those types.
"""
from numba.extending import overload
jit_options = dict()
if pipeline_class is not None:
jit_options['pipeline_class'] = pipeline_class
jit_options['cache'] = cache
jit_options |= options

if function is not None:
overload(function, jit_options=jit_options,
strict=False)(function)
return function
else:
def wrapper(func):
overload(func, jit_options=jit_options,
strict=False)(func)
return func
return wrapper


class Turn(Enum):
Left = -1
Straight = 0
Expand Down Expand Up @@ -183,7 +210,7 @@ def _follow(
# Generator of numba-compatible comparison functions for values.
# If both values are integers use a fast equality operator, otherwise use a
# slower floating-point comparison like numpy.isclose.
@nb.generated_jit(nogil=True, nopython=True)
@generated_jit(nogil=True, nopython=True)
def _is_close(
reference: Union[int, float],
value: Union[int, float],
Expand Down

0 comments on commit 950ca44

Please sign in to comment.