GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Reject unholdable weights in from_networkx without asking scipy by eriknw · Pull Request #644 · python-graphblas/python-graphblas

Conversation

@eriknw

@eriknw eriknw commented Oct 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

For strings, objects, ints beyond 64 bits and uniform-length sequences,
from_networkx still called nx.to_scipy_sparse_array only so that scipy would
raise. The error therefore depended on scipy: ValueError since 1.15, TypeError
or NetworkXError before, and ModuleNotFoundError from inside networkx with
scipy not installed. The fallback never returned a matrix, so it is removed and
the ValueError is raised directly:

edge weights must be bool, int (at most 64 bits), float or complex scalars;
attribute 'weight' gives dtype <U1

from_networkx no longer touches scipy at all. The docstring gains a Raises
section. Tests: four weight kinds on four graph classes, with scipy importable
and with it blocked through sys.modules (a small _block_scipy(monkeypatch)
helper), replacing the tests that skipped without scipy. Only the message
changes when scipy is installed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@eriknw
eriknw added this pull request to stack #650 October 19, 2026 07:50
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch from 571d77d to f53eab1 Compare October 19, 2026 07:55
@codecov

codecov Bot commented Oct 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (20-networkx-ingestion@ca784d4). Learn more about missing BASE report.

Additional details and impacted files
@@                   Coverage Diff                    @@
##             20-networkx-ingestion     #644   +/-   ##
========================================================
  Coverage                         ?   99.06%           
========================================================
  Files                            ?      106           
  Lines                            ?    32921           
  Branches                         ?     3829           
========================================================
  Hits                             ?    32614           
  Misses                           ?      221           
  Partials                         ?       86           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch 3 times, most recently from 6113fd6 to bbd4362 Compare October 21, 2026 08:38
@eriknw
eriknw removed this pull request from stack #650 October 28, 2026 04:29
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch from bbd4362 to d507287 Compare October 28, 2026 04:29
@eriknw
eriknw added this pull request to stack #653 October 28, 2026 04:30
@eriknw
eriknw removed this pull request from stack #653 October 28, 2026 04:31
@eriknw
eriknw added this pull request to stack #655 October 28, 2026 04:32
@eriknw
eriknw removed this pull request from stack #655 October 28, 2026 04:33
@eriknw
eriknw added this pull request to stack #657 October 28, 2026 04:33
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch 2 times, most recently from 1d20b11 to 5f883b9 Compare October 29, 2026 02:01
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch 2 times, most recently from 00d0249 to 75fcc19 Compare November 3, 2026 12:10
@eriknw
eriknw removed this pull request from stack #657 November 3, 2026 16:44
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch from 75fcc19 to 25b9b65 Compare November 3, 2026 16:44
@eriknw
eriknw added this pull request to stack #660 November 3, 2026 16:45
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch 2 times, most recently from a5e4b11 to aa83f70 Compare November 3, 2026 23:09
@eriknw
eriknw removed this pull request from stack #660 November 3, 2026 23:09
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch 3 times, most recently from 6941029 to 97d7af8 Compare November 10, 2026 06:25
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch 17 times, most recently from f64d00c to 1d01e55 Compare November 11, 2026 05:42
@eriknw
eriknw removed this pull request from stack #666 November 12, 2026 06:13
@eriknw
eriknw changed the base branch from 29-io-config-coverage to main November 12, 2026 06:14
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch from 1d01e55 to 4643139 Compare November 12, 2026 06:15
@eriknw
eriknw changed the base branch from main to 20-networkx-ingestion November 12, 2026 06:16
@eriknw
eriknw added this pull request to stack #670 November 12, 2026 06:17
@eriknw eriknw mentioned this pull request Nov 12, 2026
Test the fmm engine guards and config key completions; combine repeated indices in csr, csc and GCXS imports #609
Merged
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch from 4643139 to ecfe7b3 Compare November 12, 2026 17:10
@eriknw
Reject unholdable weights in from_networkx without asking scipy
467f9d4
from_networkx builds its coo arrays directly, but for weights a matrix
cannot hold (strings, objects, ints beyond 64 bits, uniform-length
sequences) it still called nx.to_scipy_sparse_array, only so that scipy
would raise. That made the error depend on scipy: ValueError since 1.15,
a TypeError or a NetworkXError blaming the sparse format before (which
abf6f62 restated as ValueError), and, with scipy not installed, a
ModuleNotFoundError from inside networkx. The fallback never returned a
matrix, so from_networkx otherwise had no use for scipy at all.

Raise the ValueError directly, naming the attribute and what it gave:

    edge weights must be bool, int (at most 64 bits), float or complex
    scalars; attribute 'weight' gives dtype <U1

and drop _from_networkx_via_scipy. The docstring gains a Raises section
for this and for the NetworkXError cases it shares with
nx.to_scipy_sparse_array. Only the message changes for callers with
scipy; callers without it get the ValueError instead of an ImportError.

The rejection tests are folded into one that covers each kind of weight
on all four graph classes, with scipy importable and with it blocked
through sys.modules, so they no longer skip without scipy. The
multigraph scipy-free test blocks scipy the same way instead of
monkeypatching the removed fallback.
@eriknw
eriknw force-pushed the 41-networkx-error-without-scipy branch from ecfe7b3 to 467f9d4 Compare November 12, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@eriknw
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.