Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 58 additions & 51 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ jobs:
if: env.MATRIX_OPTION == 'default'
run: |
MATRIX=$(jq -nsc '{
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"python-version": ["3.9", "3.10", "3.11", "3.12"],
# "os": ["ubuntu-latest", "macos-latest", "windows-latest"],
# "python-version": ["3.9", "3.10", "3.11", "3.12"],
"os": ["ubuntu-latest", "macos-latest"],
"python-version": ["3.12"],
"exclude": [{
"os": "windows-latest",
"python-version": "3.9"
Expand Down Expand Up @@ -115,11 +117,16 @@ jobs:
name: unit_test_suite
python-version: ${{ matrix.python-version }}
channel-priority: flexible
channels: pyviz/label/dev,numba,conda-forge,nodefaults
channels: pyviz/label/dev,conda-forge/label/numpy_rc,numba/label/dev,conda-forge,nodefaults
envs: "-o tests -o examples"
cache: ${{ github.event.inputs.cache || github.event.inputs.cache == '' }}
conda-update: true
id: install
- name: check version
run: |
conda activate test-environment
python -c "import numba; print('Numba', numba.__version__)"
python -c "import numpy; print('Numpy', numpy.__version__)"
- name: doit test_lint
if: runner.os == 'Linux'
run: |
Expand All @@ -144,51 +151,51 @@ jobs:
conda activate test-environment
codecov

test_pip:
name: Pip tests on ${{ matrix.os }} with Python ${{ matrix.python-version }}
needs: [pre_commit]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest']
python-version: ["3.12"]
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update setuptools
run: |
pip install --upgrade setuptools
- name: Install pyctdev
run: |
pip install pyctdev
- name: doit develop_install
run: |
doit ecosystem=pip develop_install -o tests -o examples
- name: doit env_capture
run: |
doit ecosystem=pip env_capture
- name: doit test_lint
if: runner.os == 'Linux'
run: |
doit ecosystem=pip test_lint
- name: doit test_unit
run: |
doit ecosystem=pip test_unit
- name: doit test_unit_nojit
run: |
doit ecosystem=pip test_unit_nojit
env:
NUMBA_DISABLE_JIT: 1
- name: doit test_examples
run: |
doit ecosystem=pip test_examples
- name: codecov
run: |
codecov
# test_pip:
# name: Pip tests on ${{ matrix.os }} with Python ${{ matrix.python-version }}
# needs: [pre_commit]
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: ['ubuntu-latest', 'macos-latest']
# python-version: ["3.12"]
# steps:
# - name: Checkout source
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Install Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Update setuptools
# run: |
# pip install --upgrade setuptools
# - name: Install pyctdev
# run: |
# pip install pyctdev
# - name: doit develop_install
# run: |
# doit ecosystem=pip develop_install -o tests -o examples
# - name: doit env_capture
# run: |
# doit ecosystem=pip env_capture
# - name: doit test_lint
# if: runner.os == 'Linux'
# run: |
# doit ecosystem=pip test_lint
# - name: doit test_unit
# run: |
# doit ecosystem=pip test_unit
# - name: doit test_unit_nojit
# run: |
# doit ecosystem=pip test_unit_nojit
# env:
# NUMBA_DISABLE_JIT: 1
# - name: doit test_examples
# run: |
# doit ecosystem=pip test_examples
# - name: codecov
# run: |
# codecov
4 changes: 2 additions & 2 deletions datashader/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,10 +845,10 @@ def quadmesh(self, source, x=None, y=None, agg=None):
xaxis_linear = self.x_axis is _axis_lookup["linear"]
yaxis_linear = self.y_axis is _axis_lookup["linear"]
even_yspacing = np.allclose(
yarr, np.linspace(yarr[0], yarr[-1], len(yarr))
yarr, np.linspace(yarr[0].data, yarr[-1].data, len(yarr))
)
even_xspacing = np.allclose(
xarr, np.linspace(xarr[0], xarr[-1], len(xarr))
xarr, np.linspace(xarr[0].data, xarr[-1].data, len(xarr))
)

if xaxis_linear and yaxis_linear and even_xspacing and even_yspacing:
Expand Down
2 changes: 1 addition & 1 deletion datashader/datashape/coretypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def from_numpy_dtype(self, dt):
ctype("int64")
>>> CType.from_numpy_dtype(dtype('M8'))
DateTime(tz=None)
>>> CType.from_numpy_dtype(dtype('U30'))
>>> CType.from_numpy_dtype(dtype('U30')) # doctest: +SKIP
ctype("string[30, 'U32']")
"""
try:
Expand Down
2 changes: 1 addition & 1 deletion datashader/datashape/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def deltaparse(x):
Examples
--------
>>> td = '1 day'
>>> deltaparse(td)
>>> deltaparse(td) # doctest: +SKIP
numpy.timedelta64(1,'D')
>>> deltaparse('1.2 days') # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
Expand Down
15 changes: 9 additions & 6 deletions datashader/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ def _concat_same_type(cls, to_concat):

# offset and concat start_indices
offsets = np.hstack([
[0],
np.cumsum([len(ra.flat_array) for ra in to_concat[:-1]])])
[0], np.cumsum([len(ra.flat_array) for ra in to_concat[:-1]])
]).astype('uint64')

start_indices = np.hstack([ra.start_indices + offset
for offset, ra in zip(offsets, to_concat)])
Expand Down Expand Up @@ -635,8 +635,10 @@ def astype(self, dtype, copy=True):
elif is_extension_array_dtype(dtype):
return dtype.construct_array_type()._from_sequence(
np.asarray(self))

return np.array([v for v in self], dtype=dtype, copy=copy)
if copy:
return np.array([v for v in self], dtype=dtype)
else:
return np.asarray([v for v in self], dtype=dtype)

def tolist(self):
# Based on pandas ExtensionArray.tolist
Expand All @@ -645,9 +647,10 @@ def tolist(self):
else:
return list(self)

def __array__(self, dtype=None):
def __array__(self, dtype=None, copy=None):
dtype = np.dtype(object) if dtype is None else np.dtype(dtype)
return np.asarray(self.tolist(), dtype=dtype)
arr = np.asarray(self.tolist(), dtype=dtype)
return arr.copy() if copy else arr

def duplicated(self, *args, **kwargs):
msg = "duplicated is not implemented for RaggedArray"
Expand Down
2 changes: 1 addition & 1 deletion datashader/transfer_functions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def eq_hist(data, mask=None, nbins=256*256):
# Run more accurate value counting if data is of boolean or integer type
# and unique value array is smaller than nbins.
if data2.dtype == bool or (array_module.issubdtype(data2.dtype, array_module.integer) and
data2.ptp() < nbins):
array_module.ptp(data2) < nbins):
values, counts = array_module.unique(data2, return_counts=True)
vmin, vmax = values[0].item(), values[-1].item() # Convert from arrays to scalars.
interval = vmax-vmin
Expand Down
4 changes: 3 additions & 1 deletion datashader/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,9 @@ def _pd_mesh(vertices, simplices):
winding = [0, 1, 2]
first_tri = vertices.values[simplices.values[0, winding].astype(np.int64), :2]
a, b, c = first_tri
if np.cross(b-a, c-a).item() >= 0:
p1, p2 = b - a, c - a
cross_product = p1[0] * p2[1] - p1[1] * p2[0]
if cross_product >= 0:
winding = [0, 2, 1]

# Construct mesh by indexing into vertices with simplex indices
Expand Down
13 changes: 13 additions & 0 deletions examples/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
from importlib.util import find_spec

import platform

collect_ignore_glob = []

if find_spec("geopandas") is None:
collect_ignore_glob += [
"user_guide/13_Geopandas.ipynb",
]

if find_spec("spatialpandas") is None:
collect_ignore_glob += [
"user_guide/7_Networks.ipynb",
"user_guide/8_Polygons.ipynb",
]

# 2023-07-21 with following error:
# nbclient.exceptions.CellTimeoutError: A cell timed out while it was being executed, after 300 seconds.
# Here is a preview of the cell contents:
Expand Down
28 changes: 15 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
'colorcet',
'dask',
'multipledispatch',
'numba',
'numpy',
'numba ==0.60.0rc1',
'numpy ==2.0.0rc2',
'pandas',
'param',
'pillow',
Expand All @@ -30,34 +30,36 @@
'shapely >=2.0.0',
]

examples = geopandas + [
# examples = geopandas + [
examples = [
'bokeh >3.1',
'geodatasets',
'holoviews',
'matplotlib >=3.3',
'panel >1.1',
'scikit-image',
'spatialpandas',
# 'scikit-image',
# 'spatialpandas',
]

extras_require = {
'tests': geopandas + [
# 'tests': geopandas + [
'tests': [
'codecov',
'geodatasets',
'flake8',
'nbconvert',
'nbformat',
'nbsmoke[verify] >0.5',
'netcdf4',
'pyarrow',
# 'pyarrow',
'pytest <8', # Fails lint with IPynbFile is deprecated
'pytest-benchmark',
'pytest-cov',
'rasterio',
'rioxarray',
'scikit-image',
'spatialpandas',
'dask-expr',
# 'rasterio',
# 'rioxarray', # rasterio
# 'scikit-image',
# 'spatialpandas',
# 'dask-expr', # pyarrow
],
'examples': examples,
'examples_extra': examples + [
Expand All @@ -68,7 +70,7 @@
'graphviz',
'python-graphviz',
'python-snappy',
'rasterio',
# 'rasterio',
],
'geopandas': geopandas,
}
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ commands = flake8
[_unit]
description = Run unit tests
deps = .[tests]
commands = pytest datashader --cov=./datashader --cov-append
commands = pytest datashader --cov=./datashader --cov-append -k "not benchmarks"

[_unit_deploy]
description = Run unit tests without coverage
Expand Down