Skip to content

fix: NumPy 2.0 compat shim for spycy in cypher module - #191

Merged
villelaitila merged 1 commit into
softagram:mainfrom
villelaitila:fix/spycy-numpy2-shim
Aug 27, 2026
Merged

fix: NumPy 2.0 compat shim for spycy in cypher module#191
villelaitila merged 1 commit into
softagram:mainfrom
villelaitila:fix/spycy-numpy2-shim

Conversation

@villelaitila

Copy link
Copy Markdown
Contributor

Summary

  • spycy <= 0.0.3 still references np.float_, removed in NumPy 2.0, so Cypher numeric functions (toInteger/toFloat/toString) and result conversion crash with AttributeError on NumPy >= 2.0.
  • sgraph.cypher now restores the alias (np.float_ = np.float64) before importing spycy — a no-op on NumPy 1.x, where they were the same object. Marked for removal once a spycy release containing fix: NumPy 2.0 compatibility — replace removed np.float_ with np.float64 aneeshdurg/spycy#3 (the upstream one-line fix, submitted separately) is required.
  • Adds a regression test (tests/test_cypher_numpy_compat.py, skipped when spycy is not installed) so a numpy/spycy upgrade cannot silently reintroduce the crash.

Test Plan

  • New regression tests pass with released spycy 0.0.3 + NumPy 2.5.2 (current latest)
  • Full suite: 556 passed

spycy <= 0.0.3 references np.float_, removed in NumPy 2.0, so
toInteger/toFloat/toString crash with AttributeError. Restore the
alias (identical to np.float64 on NumPy 1.x) before importing spycy,
with a regression test. Remove once a spycy release containing
aneeshdurg/spycy#3 is required.
@softagram-bot

Copy link
Copy Markdown

Softagram Impact Report for pull/191 (head commit: 709906f)

TL;DR Arch. Impact: 1 | Changed code files: 2 | Directly impacted code files: 0

⭐ Change Overview

Showing the changed files, dependency changes and the impact - click for full size
(Open in Softagram Desktop for full details)

🤖 AGENTS - machine-readable impact data (2 files changed, 0 impacted, +10/-0 deps)

Change overview

Head 709906fc4776 vs base 730a24eb1d06. 2 code files changed. 0 unchanged files directly depend on the changed files (see Impacted files). Dependencies: 10 added, 0 removed. New external components: 2. Removed external components: 0.

Added dependencies (10)

from to type roles signal
sgraph/src> sgraph/cypher.py External/Python/numpy import prod→external new external component
sgraph/tests/test_cypher_numpy_compat.py sgraph/src> sgraph/cypher.py/cypher_query import test→prod expands test coverage
sgraph/tests/test_cypher_numpy_compat.py sgraph/src> sgraph/sgraph.py/SGraph import test→prod expands test coverage
sgraph/tests/test_cypher_numpy_compat.py/build_model sgraph/src> sgraph/sgraph.py/SGraph typeref test→prod expands test coverage
sgraph/tests/test_cypher_numpy_compat.py/build_model sgraph/src> sgraph/sgraph.py/SGraph import test→prod expands test coverage
sgraph/tests/test_cypher_numpy_compat.py/test_to_float_and_to_string External/Python/sgraph/cypher/cypher_query import test→external new external component
sgraph/tests/test_cypher_numpy_compat.py/test_to_integer_in_where_and_return External/Python/sgraph/cypher/cypher_query import test→external new external component
sgraph/tests/test_cypher_numpy_compat.py External/Python/Usual dependencies import test→external external dependency
sgraph/tests/test_cypher_numpy_compat.py/test_to_float_and_to_string sgraph/tests/test_cypher_numpy_compat.py/build_model func_ref test→test regular
sgraph/tests/test_cypher_numpy_compat.py/test_to_integer_in_where_and_return sgraph/tests/test_cypher_numpy_compat.py/build_model func_ref test→test regular

Removed dependencies (0)

None.

Impacted files (0)

None.

Complete data

[]

📄 Full report

Impact Report explained. Give feedback on this report to support@softagram.com

@villelaitila
villelaitila merged commit 60aa32d into softagram:main Aug 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants