From 5ac6d2f39c5d464932b977cb9e1b8bc36c0bd23f Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Wed, 18 Oct 2023 14:28:45 -0500 Subject: [PATCH 1/7] Test against Python 3.12 in CI and update pre-commit versions --- .github/workflows/publish_pypi.yml | 2 +- .github/workflows/test.yml | 2 +- .pre-commit-config.yaml | 8 ++++---- pyproject.toml | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index e48524f..1970710 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.8" + python-version: "3.9" - name: Install build dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0ff6ab9..75081e7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: fail-fast: true matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 474539b..55021f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,7 +33,7 @@ repos: - id: name-tests-test args: ["--pytest-test-first"] - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.14 + rev: v0.15 hooks: - id: validate-pyproject name: Validate pyproject.toml @@ -58,12 +58,12 @@ repos: - id: auto-walrus args: [--line-length, "100"] - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 23.10.0 hooks: - id: black # - id: black-jupyter - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.292 + rev: v0.1.0 hooks: - id: ruff args: [--fix-only, --show-fixes] @@ -89,7 +89,7 @@ repos: additional_dependencies: [tomli] files: ^(graphblas_algorithms|docs)/ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.292 + rev: v0.1.0 hooks: - id: ruff # `pyroma` may help keep our package standards up to date if best practices change. diff --git a/pyproject.toml b/pyproject.toml index 78b07ef..6ed6386 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3 :: Only", "Intended Audience :: Developers", "Intended Audience :: Other Audience", @@ -80,7 +81,7 @@ changelog = "https://github.com/python-graphblas/graphblas-algorithms/releases" test = [ "pytest", "networkx >=3.0", - "scipy >=1.8", + "scipy >=1.9", "setuptools", "tomli", ] @@ -133,7 +134,7 @@ dirty_template = "{tag}+{ccount}.g{sha}.dirty" [tool.black] line-length = 100 -target-version = ["py39", "py310", "py311"] +target-version = ["py39", "py310", "py311", "py312"] [tool.isort] sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] From 11d1697e90352399f67876f43666dce34615a751 Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Wed, 18 Oct 2023 14:49:52 -0500 Subject: [PATCH 2/7] oops, python-graphblas didn't build for Python 3.12 on conda-forge --- .github/workflows/test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 75081e7..d58106a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,7 +48,12 @@ jobs: auto-activate-base: false - name: Install dependencies run: | - $(command -v mamba || command -v conda) install python-graphblas scipy pandas pytest-cov pytest-randomly pytest-mpl + $(command -v mamba || command -v conda) install python-suitesparse-graphblas scipy pandas pytest-cov pytest-randomly pytest-mpl \ + ${{ matrix.python-version != '3.12' && 'python-graphblas' || '' }} + if [[ ${{ matrix.python-version }} == "3.12" ]]; then + # TODO: install via conda once there are builds for 3.12 + pip install --no-deps python-graphblas + fi # matplotlib lxml pygraphviz pydot sympy # Extra networkx deps we don't need yet pip install git+https://github.com/networkx/networkx.git@main --no-deps pip install -e . --no-deps From 3a36001449edc7ee8add13a85b9e1e1cff09d453 Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Wed, 18 Oct 2023 14:55:44 -0500 Subject: [PATCH 3/7] Install more dependencies --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d58106a..82f463b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,8 +48,8 @@ jobs: auto-activate-base: false - name: Install dependencies run: | - $(command -v mamba || command -v conda) install python-suitesparse-graphblas scipy pandas pytest-cov pytest-randomly pytest-mpl \ - ${{ matrix.python-version != '3.12' && 'python-graphblas' || '' }} + $(command -v mamba || command -v conda) install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy \ + pytest-cov pytest-randomly pytest-mpl ${{ matrix.python-version != '3.12' && 'python-graphblas' || '' }} if [[ ${{ matrix.python-version }} == "3.12" ]]; then # TODO: install via conda once there are builds for 3.12 pip install --no-deps python-graphblas From 377c9bde3ad30fb8006b3425ce15422f965b0378 Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Wed, 18 Oct 2023 15:52:06 -0500 Subject: [PATCH 4/7] oops fix --- graphblas_algorithms/algorithms/shortest_paths/weighted.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphblas_algorithms/algorithms/shortest_paths/weighted.py b/graphblas_algorithms/algorithms/shortest_paths/weighted.py index 5afa0f4..0c2883c 100644 --- a/graphblas_algorithms/algorithms/shortest_paths/weighted.py +++ b/graphblas_algorithms/algorithms/shortest_paths/weighted.py @@ -27,7 +27,7 @@ def _bellman_ford_path_length(G, source, target=None, *, cutoff=None, name): is_negative, iso_value = G.get_properties("has_negative_edges+ iso_value") if not is_negative: if cutoff is not None: - cutoff = int(cutoff // iso_value) + cutoff = int(cutoff // iso_value.get()) d = _bfs_level(G, source, target, cutoff=cutoff, dtype=iso_value.dtype) if dst_id is not None: d = d.get(dst_id) From b5cd01cc6fb58714767941f438413b896dd759ed Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Wed, 18 Oct 2023 20:33:02 -0500 Subject: [PATCH 5/7] I think python-graphblas is on Python 3.12 now --- .github/workflows/test.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 82f463b..c6a2e83 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,11 +49,7 @@ jobs: - name: Install dependencies run: | $(command -v mamba || command -v conda) install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy \ - pytest-cov pytest-randomly pytest-mpl ${{ matrix.python-version != '3.12' && 'python-graphblas' || '' }} - if [[ ${{ matrix.python-version }} == "3.12" ]]; then - # TODO: install via conda once there are builds for 3.12 - pip install --no-deps python-graphblas - fi + pytest-cov pytest-randomly pytest-mpl # matplotlib lxml pygraphviz pydot sympy # Extra networkx deps we don't need yet pip install git+https://github.com/networkx/networkx.git@main --no-deps pip install -e . --no-deps From bb5fb1c62766c22a1a0238295b6c7f77fbe4b38b Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Wed, 18 Oct 2023 20:38:53 -0500 Subject: [PATCH 6/7] haha oops --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c6a2e83..82f5929 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,7 +48,7 @@ jobs: auto-activate-base: false - name: Install dependencies run: | - $(command -v mamba || command -v conda) install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy \ + $(command -v mamba || command -v conda) install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy python-graphblas \ pytest-cov pytest-randomly pytest-mpl # matplotlib lxml pygraphviz pydot sympy # Extra networkx deps we don't need yet pip install git+https://github.com/networkx/networkx.git@main --no-deps From f2bb2c6b4c2923b38e49ceb55e49273ad61ac4c4 Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Wed, 18 Oct 2023 21:08:43 -0500 Subject: [PATCH 7/7] I'm too impatient... let's just merge and release! --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 82f5929..e04e92f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: fail-fast: true matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11"] steps: - name: Checkout uses: actions/checkout@v4