Skip to content

Update to numba 0.59 and other version updates #536

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

Merged
merged 7 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
55 changes: 31 additions & 24 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,35 +167,38 @@ jobs:
# First let's randomly get versions of dependencies to install.
# Consider removing old versions when they become problematic or very old (>=2 years).
nxver=$(python -c 'import random ; print(random.choice(["=2.7", "=2.8", "=3.0", "=3.1", "=3.2", ""]))')
yamlver=$(python -c 'import random ; print(random.choice(["=5.4", "=6.0", ""]))')
sparsever=$(python -c 'import random ; print(random.choice(["=0.13", "=0.14", ""]))')
fmmver=$(python -c 'import random ; print(random.choice(["=1.4", "=1.5", "=1.6", "=1.7", ""]))')
sparsever=$(python -c 'import random ; print(random.choice(["=0.13", "=0.14", "=0.15", ""]))')
# Randomly choosing versions of dependencies based on Python version works surprisingly well...
if [[ ${{ startsWith(steps.pyver.outputs.selected, '3.9') }} == true ]]; then
npver=$(python -c 'import random ; print(random.choice(["=1.21", "=1.22", "=1.23", "=1.24", "=1.25", "=1.26", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=1.11", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.2", "=1.3", "=1.4", "=1.5", "=2.0", "=2.1", ""]))')
npver=$(python -c 'import random ; print(random.choice(["=1.22", "=1.23", "=1.24", "=1.25", "=1.26", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=1.11", "=1.12", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.2", "=1.3", "=1.4", "=1.5", "=2.0", "=2.1", "=2.2", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", "=2.1", "=2.2", "=2.3", "=2.4", "=2.5", ""]))')
fmmver=$(python -c 'import random ; print(random.choice(["=1.4", "=1.5", "=1.6", "=1.7", ""]))')
yamlver=$(python -c 'import random ; print(random.choice(["=5.4", "=6.0", ""]))')
elif [[ ${{ startsWith(steps.pyver.outputs.selected, '3.10') }} == true ]]; then
npver=$(python -c 'import random ; print(random.choice(["=1.21", "=1.22", "=1.23", "=1.24", "=1.25", "=1.26", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=1.11", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.3", "=1.4", "=1.5", "=2.0", "=2.1", ""]))')
npver=$(python -c 'import random ; print(random.choice(["=1.22", "=1.23", "=1.24", "=1.25", "=1.26", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=1.11", "=1.12", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.3", "=1.4", "=1.5", "=2.0", "=2.1", "=2.2", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", "=2.1", "=2.2", "=2.3", "=2.4", "=2.5", ""]))')
fmmver=$(python -c 'import random ; print(random.choice(["=1.4", "=1.5", "=1.6", "=1.7", ""]))')
yamlver=$(python -c 'import random ; print(random.choice(["=5.4", "=6.0", ""]))')
elif [[ ${{ startsWith(steps.pyver.outputs.selected, '3.11') }} == true ]]; then
npver=$(python -c 'import random ; print(random.choice(["=1.23", "=1.24", "=1.25", "=1.26", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=1.11", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.5", "=2.0", "=2.1", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=1.11", "=1.12", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.5", "=2.0", "=2.1", "=2.2", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.10", "=2.0", "=2.1", "=2.2", "=2.3", "=2.4", "=2.5", ""]))')
fmmver=$(python -c 'import random ; print(random.choice(["=1.4", "=1.5", "=1.6", "=1.7", ""]))')
yamlver=$(python -c 'import random ; print(random.choice(["=5.4", "=6.0", ""]))')
else # Python 3.12
npver=$(python -c 'import random ; print(random.choice(["=1.26", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.11", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=2.1", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.11", "=1.12", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=2.1", "=2.2", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=2.4", "=2.5", ""]))')
fmmver=$(python -c 'import random ; print(random.choice(["=1.7", ""]))')
yamlver=$(python -c 'import random ; print(random.choice(["=6.0", ""]))')
fi
# But there may be edge cases of incompatibility we need to handle (more handled below)
if [[ ${pdver} == "=2.1" && ${npver} == "=1.21" ]]; then
pdver="=2.0"
fi
if [[ ${{ steps.sourcetype.outputs.selected }} == "source" || ${{ steps.sourcetype.outputs.selected }} == "upstream" ]]; then
# TODO: there are currently issues with some numpy versions when
# installing python-suitesparse-grphblas from source or upstream.
Expand Down Expand Up @@ -226,28 +229,32 @@ jobs:
psgver=$(python -c 'import random ; print(random.choice(["==7.4.0.0", "==7.4.1.0", "==7.4.2.0", "==7.4.3.0", "==7.4.3.1", "==7.4.3.2", "==8.0.2.1", "==8.2.0.1", "==8.2.1.0", ""]))')
fi
if [[ ${npver} == "=1.26" ]] ; then
numbaver=""
numbaver=$(python -c 'import random ; print(random.choice(["=0.58", "=0.59", ""]))')
if [[ ${spver} == "=1.9" ]] ; then
spver=$(python -c 'import random ; print(random.choice(["=1.10", "=1.11", ""]))')
fi
elif [[ ${npver} == "=1.25" ]] ; then
numbaver=""
numbaver=$(python -c 'import random ; print(random.choice(["=0.58", "=0.59", ""]))')
elif [[ ${npver} == "=1.24" || ${{ startsWith(steps.pyver.outputs.selected, '3.11') }} == true ]] ; then
numbaver=$(python -c 'import random ; print(random.choice(["=0.57", "=0.58", ""]))')
numbaver=$(python -c 'import random ; print(random.choice(["=0.57", "=0.58", "=0.59", ""]))')
elif [[ ${npver} == "=1.21" ]] ; then
numbaver=$(python -c 'import random ; print(random.choice(["=0.55", "=0.56", "=0.57", ""]))')
else
numbaver=$(python -c 'import random ; print(random.choice(["=0.56", "=0.57", "=0.58", ""]))')
numbaver=$(python -c 'import random ; print(random.choice(["=0.56", "=0.57", "=0.58", "=0.59", ""]))')
fi
# Only numba 0.59 support Python 3.12
if [[ ${{ startsWith(steps.pyver.outputs.selected, '3.12') }} == true ]] ; then
numbaver=$(python -c 'import random ; print(random.choice(["=0.59", ""]))')
fi
fmm=fast_matrix_market${fmmver}
awkward=awkward${akver}
if [[ ${{ contains(steps.pyver.outputs.selected, 'pypy') ||
startsWith(steps.pyver.outputs.selected, '3.12') }} == true ||
startsWith(steps.pyver.outputs.selected, '3.13') }} == true ||
( ${{ matrix.slowtask != 'notebooks'}} == true && (
( ${{ matrix.os == 'windows-latest' }} == true && $(python -c 'import random ; print(random.random() < .2)') == True ) ||
( ${{ matrix.os == 'windows-latest' }} == false && $(python -c 'import random ; print(random.random() < .4)') == True ))) ]]
then
# Some packages aren't available for pypy or Python 3.12; randomly otherwise (if not running notebooks)
# Some packages aren't available for pypy or Python 3.13; randomly otherwise (if not running notebooks)
echo "skipping numba"
numba=""
numbaver=NA
Expand All @@ -264,7 +271,7 @@ jobs:
pdver=""
yamlver=""
fi
elif [[ ${npver} == "=1.25" || ${npver} == "=1.26" ]] ; then
elif [[ ${npver} == "=2.0" ]] ; then
# Don't install numba for unsupported versions of numpy
numba=""
numbaver=NA
Expand Down Expand Up @@ -421,7 +428,7 @@ jobs:
coverage xml
coverage report --show-missing
- name: codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
- name: Notebooks Execution check
if: matrix.slowtask == 'notebooks'
run: |
Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
- id: name-tests-test
args: ["--pytest-test-first"]
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
rev: v0.16
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
Expand Down Expand Up @@ -61,25 +61,25 @@ repos:
- id: auto-walrus
args: [--line-length, "100"]
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
- id: black-jupyter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.2.1
hooks:
- id: ruff
args: [--fix-only, --show-fixes]
# Let's keep `flake8` even though `ruff` does much of the same.
# `flake8-bugbear` and `flake8-simplify` have caught things missed by `ruff`.
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: &flake8_dependencies
# These versions need updated manually
- flake8==6.1.0
- flake8-bugbear==23.12.2
- flake8==7.0.0
- flake8-bugbear==24.1.17
- flake8-simplify==0.21.0
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
Expand All @@ -94,7 +94,7 @@ repos:
additional_dependencies: [tomli]
files: ^(graphblas|docs)/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.2.1
hooks:
- id: ruff
- repo: https://github.com/sphinx-contrib/sphinx-lint
Expand Down
1 change: 1 addition & 0 deletions graphblas/agg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
# - bxnor monoid: even bits
# - bnor monoid: odd bits
"""

# All items are dynamically added by classes in core/operator/agg.py
# This module acts as a container of Aggregator instances
_deprecated = {}
Expand Down
1 change: 1 addition & 0 deletions graphblas/binary/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
https://numba.readthedocs.io/en/stable/reference/numpysupported.html#math-operations

"""

import numpy as _np

from .. import _STANDARD_OPERATOR_NAMES
Expand Down
1 change: 1 addition & 0 deletions graphblas/core/automethods.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$ python -m graphblas.core.automethods

"""

from .. import config


Expand Down
3 changes: 1 addition & 2 deletions graphblas/core/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,7 @@ def lookup_dtype(key, value=None):


def unify(type1, type2, *, is_left_scalar=False, is_right_scalar=False):
"""
Returns a type that can hold both type1 and type2.
"""Returns a type that can hold both type1 and type2.

For example:
unify(INT32, INT64) -> INT64
Expand Down
8 changes: 4 additions & 4 deletions graphblas/core/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ def py_indices(self):
return self.indices[0]._py_index()

def parse_indices(self, indices, shape):
"""
Returns
"""Returns
-------
[(rows, rowsize), (cols, colsize)] for Matrix
[(idx, idx_size)] for Vector

Within each tuple, if the index is of type int, the size will be None

"""
if len(shape) == 1:
if type(indices) is tuple:
Expand Down Expand Up @@ -312,8 +312,8 @@ def update(self, expr, **opts):
Updater(self.parent, opts=opts)._setitem(self.resolved_indexes, expr, is_submask=False)

def new(self, dtype=None, *, mask=None, input_mask=None, name=None, **opts):
"""
Force extraction of the indexes into a new object
"""Force extraction of the indexes into a new object.

dtype and mask are the only controllable parameters.
"""
if input_mask is not None:
Expand Down
Loading