Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.12 support #1317

Merged
merged 37 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2a01779
Pin pytest for now.
hoxbro Jan 31, 2024
af10be7
Update to ddf = ddf.repartition(npartitions=npartitions)
hoxbro Jan 31, 2024
38e6964
Ignore test_ffil_limit_area
hoxbro Jan 31, 2024
6fb8e3d
Work-around Pandas 2.2 changes for Extension
hoxbro Jan 31, 2024
2639541
Fix lint
hoxbro Jan 31, 2024
5468a0d
Move pytest setting to pyproject.toml
hoxbro Feb 1, 2024
bc9c409
Fix mix warnings in test suite
hoxbro Feb 1, 2024
51997fc
Make xfail run
hoxbro Feb 1, 2024
001446a
Try commenting out fastparquet for slow windows solve
hoxbro Feb 1, 2024
db5a902
Update nbsmoke_skip_run
hoxbro Feb 1, 2024
03adc9a
Update setup.py
hoxbro Feb 1, 2024
b2ff68c
Ignore dask geopandas warning for now
hoxbro Feb 9, 2024
b466c2f
Update skipif to only be valid for pandas 2.2.0
hoxbro Feb 10, 2024
8d3ada0
Add NotImplementedError for duplicated.
hoxbro Feb 12, 2024
77a8b0e
Add Python 3.12 support
hoxbro Feb 8, 2024
f01d324
Run 3.12 on pypi for now
hoxbro Feb 8, 2024
68b982e
Fix deprecation warning
hoxbro Feb 9, 2024
42e908b
Merge branch 'main' into py312
hoxbro Feb 13, 2024
b01a54b
Merge branch 'main' into py312
hoxbro Apr 4, 2024
dc572cd
Update install task
hoxbro Apr 4, 2024
7631a28
Add dask-expr to install requires
hoxbro Apr 4, 2024
8183503
Add setup matrix creation and cache toggle
hoxbro Apr 4, 2024
394d284
Disable dask-expr for now
hoxbro Apr 4, 2024
ca5f599
Make channel priority flexible
hoxbro Apr 4, 2024
c493e25
Remove dask setting to conftest
hoxbro Apr 4, 2024
c0076bc
Update conftest
hoxbro Apr 4, 2024
5beb309
Add warning if query-planning is enabled
hoxbro Apr 4, 2024
f1e41f0
move conftest back
hoxbro Apr 4, 2024
5993099
Disable query planning globally
hoxbro Apr 4, 2024
646db4e
Update example conftest
hoxbro Apr 4, 2024
234b8d7
Set environment variables for query-planning
hoxbro Apr 4, 2024
baa9e78
Try adding df.optimize()
hoxbro Apr 5, 2024
dc403ae
Add dask-expr to setup.py
hoxbro Apr 5, 2024
8b5d3d5
Use legacy dask.dataframe for now
hoxbro Apr 5, 2024
1223949
Add fix for dask tokenize tuple
philippjfr Apr 8, 2024
7674d45
Update to work with more tests
hoxbro Apr 8, 2024
67d73f5
Fix attribute assignment
hoxbro Apr 8, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
env:
DESC: "Documentation build"
steps:
- uses: holoviz-dev/holoviz_tasks/install@v0.1a17
- uses: holoviz-dev/holoviz_tasks/install@v0
with:
name: Documentation
python-version: "3.10"
Expand Down
87 changes: 72 additions & 15 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,107 @@ on:
branches:
- '*'
workflow_dispatch:
inputs:
target:
description: "How much of the test suite to run"
type: choice
default: default
options:
- default
- full
- downstream
cache:
description: "Use cache"
type: boolean
default: true
schedule:
- cron: '0 16 * * SUN'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
MKL_NUM_THREADS: 1
VECLIB_MAXIMUM_THREADS: 1
NUMEXPR_NUM_THREADS: 1
PYDEVD_DISABLE_FILE_VALIDATION: 1
DASK_DATAFRAME__QUERY_PLANNING: false

jobs:
pre_commit:
name: Run pre-commit
runs-on: 'ubuntu-latest'
steps:
- uses: holoviz-dev/holoviz_tasks/[email protected]
- uses: holoviz-dev/holoviz_tasks/pre-commit@v0

setup:
name: Setup workflow
runs-on: ubuntu-latest
outputs:
matrix: ${{ env.MATRIX }}
steps:
- name: Set matrix option
run: |
if [[ '${{ github.event_name }}' == 'workflow_dispatch' ]]; then
OPTION=${{ github.event.inputs.target }}
elif [[ '${{ github.event_name }}' == 'schedule' ]]; then
OPTION="full"
elif [[ '${{ github.event_name }}' == 'push' && '${{ github.ref_type }}' == 'tag' ]]; then
OPTION="full"
else
OPTION="default"
fi
echo "MATRIX_OPTION=$OPTION" >> $GITHUB_ENV
- name: Set test matrix with 'default' option
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"]
}')
echo "MATRIX=$MATRIX" >> $GITHUB_ENV
- name: Set test matrix with 'full' option
if: env.MATRIX_OPTION == 'full'
run: |
MATRIX=$(jq -nsc '{
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"python-version": ["3.9", "3.10", "3.11", "3.12"]
}')
echo "MATRIX=$MATRIX" >> $GITHUB_ENV
- name: Set test matrix with 'downstream' option
if: env.MATRIX_OPTION == 'downstream'
run: |
MATRIX=$(jq -nsc '{
"os": ["ubuntu-latest"],
"python-version": ["3.11"]
}')
echo "MATRIX=$MATRIX" >> $GITHUB_ENV

test_suite:
name: Tests on ${{ matrix.os }} with Python ${{ matrix.python-version }}
needs: [pre_commit]
needs: [pre_commit, setup]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ["3.9", "3.10", "3.11"]
matrix: ${{ fromJson(needs.setup.outputs.matrix) }}
timeout-minutes: 180
defaults:
run:
shell: bash -l {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
MKL_NUM_THREADS: 1
VECLIB_MAXIMUM_THREADS: 1
NUMEXPR_NUM_THREADS: 1
PYDEVD_DISABLE_FILE_VALIDATION: 1
steps:
- uses: holoviz-dev/holoviz_tasks/install@v0.1a17
- uses: holoviz-dev/holoviz_tasks/install@v0
with:
name: unit_test_suite
python-version: ${{ matrix.python-version }}
channel-priority: strict
channel-priority: flexible
channels: pyviz/label/dev,numba,conda-forge,nodefaults
envs: "-o tests -o examples"
cache: true
cache: ${{ github.event.inputs.cache || github.event.inputs.cache == '' }}
conda-update: true
id: install
- name: doit test_lint
Expand Down Expand Up @@ -85,7 +142,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest']
python-version: ["3.10"]
python-version: ["3.12"]
steps:
- name: Checkout source
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ to work with much larger datasets than it would otherwise.

## Installation

Datashader supports Python 3.8, 3.9, 3.10, and 3.11 on Linux, Windows, or
Datashader supports Python 3.9, 3.10, 3.11, and 3.12 on Linux, Windows, or
Mac and can be installed with conda:

conda install datashader
Expand Down
6 changes: 6 additions & 0 deletions datashader/data_libraries/dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def func(partition: pd.DataFrame, cumulative_lens, partition_info=None):

# Here be dragons
# Get the dataframe graph
df = getattr(df, 'optimize', lambda: df)() # Work with new dask_expr
graph = df.__dask_graph__()

# Guess a reasonable output dtype from combination of dataframe dtypes
Expand Down Expand Up @@ -210,6 +211,7 @@ def line(glyph, df, schema, canvas, summary, *, antialias=False, cuda=False):
shape, bounds, st, axis = shape_bounds_st_and_axis(df, canvas, glyph)

# Compile functions
df = getattr(df, 'optimize', lambda: df)() # Work with new dask_expr
partitioned = isinstance(df, dd.DataFrame) and df.npartitions > 1
create, info, append, combine, finalize, antialias_stage_2, antialias_stage_2_funcs, _ = \
compile_components(summary, schema, glyph, antialias=antialias, cuda=cuda,
Expand All @@ -232,6 +234,10 @@ def chunk(df, df2=None):

name = tokenize(df.__dask_tokenize__(), canvas, glyph, summary)
old_name = df.__dask_tokenize__()
# dask_expr return tokenize result as tuple of type and task name
# We only want to use the task name as input to the new graph
if isinstance(old_name, tuple):
old_name = old_name[1]
dsk = {(name, 0): (chunk, (old_name, 0))}
for i in range(1, df.npartitions):
dsk[(name, i)] = (chunk, (old_name, i - 1), (old_name, i))
Expand Down
2 changes: 1 addition & 1 deletion datashader/datashape/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
def _str_val(s):
# Use the Python parser via the ast module to parse the string,
# since the string_escape and unicode_escape codecs do the wrong thing
return ast.parse('u' + s).body[0].value.s
return ast.parse('u' + s).body[0].value.value

# A list of the token names, corresponding regex, and value extraction function
_tokens = [
Expand Down
2 changes: 1 addition & 1 deletion datashader/tests/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -2385,7 +2385,7 @@ def test_dask_categorical_counts(on_gpu):
)
ddf = dd.from_pandas(df, npartitions=2)
assert ddf.npartitions == 2
ddf.cat = ddf.cat.astype('category')
ddf["cat"] = ddf.cat.astype('category')

# Categorical counts at the dataframe level to confirm test is reasonable.
cat_totals = ddf.cat.value_counts().compute()
Expand Down
1 change: 0 additions & 1 deletion examples/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import platform


collect_ignore_glob = []

# 2023-07-21 with following error:
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
'rioxarray',
'scikit-image',
'spatialpandas',
'dask-expr',
],
'examples': examples,
'examples_extra': examples + [
Expand Down Expand Up @@ -119,6 +120,7 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[tox]
# python version test group extra envs extra commands
envlist = {py39,py310,py311}-{lint,unit,unit_nojit,unit_deploy,examples,all,examples_extra}-{default}-{dev,pkg}
envlist = {py39,py310,py311,py312}-{lint,unit,unit_nojit,unit_deploy,examples,all,examples_extra}-{default}-{dev,pkg}
build = wheel

[_lint]
Expand Down
Loading