Skip to content

Commit

Permalink
Randomize version of dependencies (python-graphblas#368)
Browse files Browse the repository at this point in the history
* Randomize version of dependencies

* Update min versions for networkx and numpy

* Don't randomize numpy version yet; issues with installing from source/upstream

* min versions for pandas, scipy, donfig

* Aha! We actually need scipy >=1.8

* Sometimes don't specify version of numpy, pandas, or scipy

* awkward >=1.9

* numba>=0.55 pyyaml>=5.4
  • Loading branch information
eriknw authored Jan 11, 2023
1 parent 925fb67 commit ccfc077
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 7 deletions.
43 changes: 41 additions & 2 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,48 @@ jobs:
run: |
# Install dependencies based on the needs of the job.
# Don't panic! This may look scary at a glance, but each line makes sense.
#
# First let's randomly get versions of dependencies to install
nxver=$(python -c 'import random ; print(random.choice(["=2.7", "=2.8", "=3.0", ""]))')
yamlver=$(python -c 'import random ; print(random.choice(["=5.4", "=6.0", ""]))')
if [[ ${{ steps.pyver.outputs.selected }} == "3.8" ]]; then
npver=$(python -c 'import random ; print(random.choice(["=1.21", "=1.22", "=1.23", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.8", "=1.9", "=1.10", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.2", "=1.3", "=1.4", "=1.5", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", ""]))')
elif [[ ${{ steps.pyver.outputs.selected }} == "3.9" ]]; then
npver=$(python -c 'import random ; print(random.choice(["=1.21", "=1.22", "=1.23", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.8", "=1.9", "=1.10", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.2", "=1.3", "=1.4", "=1.5", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", ""]))')
elif [[ ${{ steps.pyver.outputs.selected }} == "3.10" ]]; then
npver=$(python -c 'import random ; print(random.choice(["=1.21", "=1.22", "=1.23", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.8", "=1.9", "=1.10", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.3", "=1.4", "=1.5", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", "=2.0", ""]))')
else # Python 3.11
npver=$(python -c 'import random ; print(random.choice(["=1.23", ""]))')
spver=$(python -c 'import random ; print(random.choice(["=1.9", "=1.10", ""]))')
pdver=$(python -c 'import random ; print(random.choice(["=1.5", ""]))')
akver=$(python -c 'import random ; print(random.choice(["=1.10", "=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.
npver=""
spver=""
pdver=""
fi
if [[ $npver == "=1.21" ]] ; then
numbaver=$(python -c 'import random ; print(random.choice(["=0.55", "=0.56", ""]))')
else
numbaver=$(python -c 'import random ; print(random.choice(["=0.56", ""]))')
fi
echo "versions: np${npver} sp${spver} pd${pdver} ak${akver} nx${nxver} numba${numbaver} yaml${yamlver}"
# Once we have wheels for all OSes, we can delete the last two lines.
mamba install pytest coverage coveralls=3.3.1 pytest-randomly \
pandas numba scipy networkx cffi donfig pyyaml awkward \
mamba install pytest coverage coveralls=3.3.1 pytest-randomly cffi donfig pyyaml${yamlver} \
pandas${pdver} scipy${spver} numpy${npver} awkward${akver} networkx${nxver} numba${numbaver} \
${{ matrix.slowtask == 'pylint' && 'black pylint' || '' }} \
${{ matrix.slowtask == 'notebooks' && 'matplotlib nbconvert jupyter "ipython>=7"' || '' }} \
${{ steps.sourcetype.outputs.selected == 'upstream' && 'cython' || '' }} \
Expand Down
2 changes: 1 addition & 1 deletion graphblas/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def to_awkward(A, format=None):
awkward.Array
"""
try: # pragma: no cover (import)
try:
# awkward version 1
import awkward._v2 as ak
from awkward._v2.forms.listoffsetform import ListOffsetForm
Expand Down
12 changes: 12 additions & 0 deletions scripts/check_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Simple helper to check versions of dependencies.
# Use, adjust, copy/paste, etc. as necessary to answer your questions.
# This may be helpful when updating dependency versions in CI.
# Tip: add `--json` for more information.
conda search 'numpy[channel=conda-forge]>=1.24.1'
conda search 'pandas[channel=conda-forge]>=1.5.2'
conda search 'scipy[channel=conda-forge]>=1.10.0'
conda search 'networkx[channel=conda-forge]>=3.0'
conda search 'awkward[channel=conda-forge]>=2.0.5'
conda search 'numba[channel=conda-forge]>=0.56.4'
conda search 'pyyaml[channel=conda-forge]>=6.0'
14 changes: 10 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from setuptools import find_packages, setup

extras_require = {
"repr": ["pandas"],
"io": ["networkx", "scipy >=1.7.0", "awkward"],
"repr": ["pandas >=1.2"],
"io": ["networkx >=2.8", "scipy >=1.8", "awkward >=1.9"],
"viz": ["matplotlib"],
"test": ["pytest", "pandas", "scipy >=1.7.0"],
"test": ["pytest", "pandas >=1.2", "scipy >=1.8"],
}
extras_require["complete"] = sorted({v for req in extras_require.values() for v in req})

Expand All @@ -24,7 +24,13 @@
url="https://github.com/python-graphblas/python-graphblas",
packages=find_packages(),
python_requires=">=3.8",
install_requires=["suitesparse-graphblas >=7.4.0.0, <7.5", "numba", "donfig", "pyyaml"],
install_requires=[
"suitesparse-graphblas >=7.4.0.0, <7.5",
"numpy >=1.21",
"numba >=0.55",
"donfig >=0.6",
"pyyaml >=5.4",
],
extras_require=extras_require,
include_package_data=True,
license="Apache License 2.0",
Expand Down

0 comments on commit ccfc077

Please sign in to comment.