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 — Test the from_networkx int32 widening and correct its coverage claim by eriknw · Pull Request #618 · python-graphblas/python-graphblas

Conversation

@eriknw

@eriknw eriknw commented Aug 5, 2026

Copy link
Copy Markdown
Member

Stacked on #617. Overnight review of the late CI-stabilization commits found that the int32-to-int64 widening in from_networkx (added in #600's 18a5ad22) is reachable on every platform, not only win64 with numpy < 2 as its pragma: no cover claimed: np.int32 scalar edge weights infer an int32 array from the edge sequence anywhere.

The widening is deliberate and kept: from_coo widens int32 inferred from sequence input to int64 on every platform (values_to_numpy_buffer), and from_networkx builds its values from a Python sequence, so identical weights now produce the same dtype through either constructor:

import numpy as np, networkx as nx, graphblas as gb
G = nx.DiGraph()
G.add_weighted_edges_from([(0, 1, np.int32(2)), (1, 0, np.int32(3))])
gb.io.from_networkx(G).dtype                                # INT64 (was INT32 via scipy)
gb.Matrix.from_coo([0, 1], [1, 0], [np.int32(2), np.int32(3)]).dtype  # INT64, and always was

This PR drops the false pragma, restates the comment in terms of the real contract, and pins the behavior with tests: int32 weights widen and agree with from_coo, explicit dtype= is preserved exactly, and int16 stays INT16 through both constructors.

Release-note item: the from_networkx result dtype for int32-weighted graphs changes from INT32 to INT64 (2x value storage). If instead the old INT32 result is wanted, the widening condition is one line, but then from_networkx and from_coo disagree for identical weights.

Sorry, something went wrong.

Uh oh!

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

All reactions
@eriknw eriknw mentioned this pull request Aug 5, 2026
Extend the monoid guard to built-ins that carry a UDT fallback func #619
Merged
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from ea9890e to e21ed55 Compare August 5, 2026 17:44
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 8f138a4 to 2c9fdaa Compare August 5, 2026 18:03
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from e21ed55 to b320caa Compare August 5, 2026 18:03
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 2c9fdaa to 88922bd Compare August 5, 2026 18:05
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch 2 times, most recently from 62b13c7 to 9efbea8 Compare August 6, 2026 07:59
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch 2 times, most recently from 99668c2 to 1b70585 Compare August 6, 2026 15:39
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from 9efbea8 to b747942 Compare August 6, 2026 15:39
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 1b70585 to 076218f Compare August 6, 2026 15:41
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch 2 times, most recently from 402b89a to ba98df4 Compare August 6, 2026 20:36
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 1ddb541 to dd0e7ef Compare August 6, 2026 20:41
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from ba98df4 to a557f7e Compare August 6, 2026 20:41
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from dd0e7ef to 35065c5 Compare August 7, 2026 02:49
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from a557f7e to 50ef9e9 Compare August 7, 2026 02:49
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 35065c5 to 727fe12 Compare August 7, 2026 05:09
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from 50ef9e9 to f5f70f7 Compare August 7, 2026 05:09
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from f5f70f7 to e004148 Compare August 26, 2026 17:30
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 727fe12 to 896cbc8 Compare August 26, 2026 17:30
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from e004148 to cd92213 Compare September 18, 2026 03:09
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 896cbc8 to c14bd42 Compare September 18, 2026 03:09
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from cd92213 to b8460ce Compare September 18, 2026 03:46
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch 2 times, most recently from a303e64 to 654b144 Compare September 18, 2026 17:34
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from b8460ce to bab5842 Compare September 18, 2026 17:34
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 654b144 to c7ab91b Compare September 18, 2026 17:39
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch 2 times, most recently from 2217ade to ef0c194 Compare September 23, 2026 16:22
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 4842e6c to fc26567 Compare September 25, 2026 04:03
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from 0f051c7 to 6e07a29 Compare September 25, 2026 04:03
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from fc26567 to be1975f Compare September 25, 2026 06:10
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch 3 times, most recently from f527f6e to 948b7a7 Compare September 26, 2026 05:25
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch 2 times, most recently from 0b9e279 to 65ebd7b Compare September 27, 2026 15:40
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch 3 times, most recently from 3d0fe80 to b1c54f3 Compare October 1, 2026 17:11
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 5012466 to 68a11e3 Compare October 1, 2026 22:04
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch 3 times, most recently from 56b6034 to e8a9843 Compare October 3, 2026 04:57
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 6c76440 to fe3d69d Compare October 4, 2026 06:21
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from e8a9843 to 83c9eae Compare October 4, 2026 06:21
@eriknw
eriknw removed this pull request from stack #634 October 8, 2026 21:02
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from 83c9eae to 5a05e9d Compare October 8, 2026 21:40
@eriknw
eriknw added this pull request to stack #635 October 8, 2026 21:46
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from 5a05e9d to cbc8736 Compare October 9, 2026 03:06
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 1198675 to 7cfc1e1 Compare October 9, 2026 05:25
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from cbc8736 to 2edd22d Compare October 9, 2026 05:25
@eriknw
Test the from_networkx int32 widening and correct its coverage claim
9fa7a9e
The widening added while stabilizing CI was marked "pragma: no cover
(win64 numpy < 2)", but the branch is reachable on every platform:
np.int32 scalar edge weights infer an int32 array from the edge sequence
anywhere, not only where python ints do. The pragma therefore hid live
code from coverage, and the comment implied the change was platform-local
when it is user-visible everywhere: int32-weighted graphs that previously
round-tripped through scipy as INT32 now come back INT64.

The widening itself is kept, deliberately. from_coo widens an int32 dtype
inferred from sequence input to int64 on every platform
(values_to_numpy_buffer), and from_networkx builds its values from a
Python sequence, so identical weights now produce the same dtype through
either constructor. Gating the widening to win64 instead would have
re-introduced a from_coo/from_networkx disagreement everywhere else.

Drop the pragma, restate the comment in terms of the real contract, and
pin the behavior: np.int32 weights widen to INT64 and agree with from_coo,
an explicit dtype= is preserved exactly, and np.int16 stays INT16 through
both constructors. Release-note item: the from_networkx result dtype for
int32-weighted graphs changes from INT32 to INT64.
@eriknw
eriknw force-pushed the 36-monoid-builtin-binaryop-guard branch from 7cfc1e1 to d3533cb Compare October 14, 2026 18:45
@eriknw
eriknw force-pushed the 37-networkx-int32-widen-pin branch from 2edd22d to 9fa7a9e Compare October 14, 2026 18:45
@eriknw
eriknw removed this pull request from stack #635 October 19, 2026 07:45
@eriknw

eriknw commented Oct 19, 2026

Copy link
Copy Markdown
Member Author

Folded into #600 (20-networkx-ingestion), where its commit now sits.

All reactions

Sorry, something went wrong.

Uh oh!

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

@eriknw eriknw closed this Oct 19, 2026
@eriknw eriknw mentioned this pull request Oct 19, 2026
Convert from networkx without the scipy detour #600
Open
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.