Skip to content

Bump pandas 3.1.1, numpy 2.5.4, pytest 9.2.0; keep Cypher nulls null under pandas 3 - #227

Merged
villelaitila merged 2 commits into
softagram:mainfrom
villelaitila:deps/pandas3-numpy25-pytest92
Nov 16, 2026
Merged

villelaitila merged 2 commits into
softagram:mainfrom
villelaitila:deps/pandas3-numpy25-pytest92

Conversation

@villelaitila

Copy link
Copy Markdown
Contributor

Replaces the dependabot PRs #221 (pandas), #219 (pytest) and #217 (numpy) with one change that also fixes what pandas 3 breaks.

Pins (requirements.txt)

from to
pandas 2.3.3 3.1.1
numpy 2.2.6 2.5.4
pytest 9.0.3 9.2.0

install_requires is unchanged (pandas>=1.5.3, no numpy), so downstream users can stay on pandas 2.

Fix: Cypher nulls under pandas 3

The suite passed on the new pins as it was, but Cypher queries gave wrong answers whenever a value is null. spycy marks Cypher null with pd.NA and checks it with value is pd.NA; pandas 3 infers the str dtype for string columns, which stores a missing value as NaN, so a null that passes through a spycy table stops being null:

  • IS NULL (after WITH … WHERE, after OPTIONAL MATCH) matches nothing;
  • coalesce(f.extra, 'none') returns NaN; count(f.extra) counts the null; size() raises;
  • JSON / JSONL output contains NaN, which is not valid JSON.

SGraphCypherExecutor.exec now runs with future.infer_string turned off and restores it afterwards. The option does not exist before pandas 2.1 (no-op there); pandas 3 deprecates it, and only that deprecation message is suppressed. With the fix, the probe queries give identical results on pandas 3.1.1 and 2.3.3.

tests/test_cypher_null_semantics.py (8 tests): 7 fail on pandas 3.1.1 without the fix, all 8 pass on pandas 2.3.3 with or without it.

Limits: the option is process-wide (a concurrent thread sees it during a query), and pandas 4 is to remove it, after which these tests fail again. The lasting fix belongs in spycy (object columns or pd.isna); spycy also emits two pandas 3 deprecations (sort_values(inplace=…), reset_index(inplace=…)), which are the 7 warnings left in the suite.

Testing (Python 3.12.7, PYTHONPATH=src)

pins before fix after fix
old (pandas 2.3.3, numpy 2.2.6, pytest 9.0.3) 812 passed 820 passed
new (pandas 3.1.1, numpy 2.5.4, pytest 9.2.0) 812 passed 820 passed
floor (Python 3.11, pandas 1.5.3, numpy < 2) 820 passed

attributequeries.py, the other pandas user, gives identical values and types on both pandas versions (only the column dtype label changes, and the code uses to_dict()). No removed numpy API is used; the np.float_ shim in cypher.py still works on 2.5.4. flake8: no new findings.

Downstream (softagram-live)

softagram-live is already on pandas 3.0.0 and does not import sgraph.cypher, so this release changes nothing there by itself. Its own numpy cannot follow to 2.5 yet: it pins scipy==1.15.3, which requires numpy<2.5; moving needs scipy ≥ 1.16 as one numeric-stack change.

spycy marks Cypher null with pd.NA and checks for it with `is pd.NA`.
pandas 3 infers the str dtype for string columns, which stores a missing
value as NaN, so a null that passes through a spycy table stops being
null: IS NULL matches nothing, coalesce returns NaN, count counts it and
the JSON output emits NaN.

SGraphCypherExecutor.exec now turns future.infer_string off for the
duration of the query and restores it afterwards. The option does not
exist before pandas 2.1 (no-op there) and is deprecated in pandas 3, so
its deprecation warning is suppressed. Add tests that lock in the
pandas 2 null semantics.
@softagram-bot

Copy link
Copy Markdown

Softagram Impact Report for pull/227 (head commit: 59d011e)

TL;DR Arch. Impact: 📈 +32 | Changed code files: 3 | Directly impacted code files: 1

⭐ 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 (3 files changed, 1 impacted, +34/-1 deps)

Change overview

Head 59d011e43a5f vs base 68cc0e567b37. 3 code files changed. 1 unchanged files directly depend on the changed files (see Impacted files). Dependencies: 34 added, 1 removed. New external components: 1. Removed external components: 0.

Added dependencies (34)

from to type roles signal
sgraph/tests/test_cypher_null_semantics.py sgraph/src> sgraph/cypher.py/_dataframe_to_serializable import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py sgraph/src> sgraph/cypher.py/cypher_query import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py sgraph/src> sgraph/sgraph.py/SGraph import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py sgraph/src> sgraph/selementassociation.py/SElementAssociation import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/build_model sgraph/src> sgraph/sgraph.py/SGraph typeref test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/build_model sgraph/src> sgraph/sgraph.py/SGraph import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/build_model sgraph/src> sgraph/sgraph.py/SElementAssociation import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/test_coalesce_replaces_missing_property sgraph/src> sgraph/cypher.py/cypher_query import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/test_count_skips_missing_property sgraph/src> sgraph/cypher.py/cypher_query import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/test_is_null_on_missing_property_after_with sgraph/src> sgraph/cypher.py/cypher_query import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/test_is_null_on_optional_match_after_with sgraph/src> sgraph/cypher.py/cypher_query import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/test_is_null_on_unwound_null sgraph/src> sgraph/cypher.py/cypher_query import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/test_json_output_uses_null_for_missing_property sgraph/src> sgraph/cypher.py/_dataframe_to_serializable import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/test_json_output_uses_null_for_missing_property sgraph/src> sgraph/cypher.py/cypher_query import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/test_missing_value_in_result_is_pd_na sgraph/src> sgraph/cypher.py/cypher_query import test→prod expands test coverage
sgraph/tests/test_cypher_null_semantics.py/test_no_infer_string_deprecation_warning_leaks sgraph/src> sgraph/cypher.py/cypher_query import test→prod expands test coverage
sgraph/src> sgraph/cypher.py External/PythonLibs/contextlib import prod→external regular
sgraph/src> sgraph/cypher.py External/PythonLibs/warnings import prod→external regular
sgraph/tests/test_cypher_null_semantics.py External/PythonLibs/Usual dependencies import test→external regular
sgraph/tests/test_cypher_null_semantics.py External/Python/pytest import test→external regular
sgraph/tests/test_cypher_null_semantics.py External/Python/pandas import test→external regular
sgraph/tests/test_cypher_null_semantics.py External/PythonLibs/warnings import test→external regular
sgraph/src> sgraph/cypher.py/_run_repl sgraph/src> sgraph/cypher.py/SGraphCypherExecutor/exec func_ref prod→prod regular
sgraph/tests/test_cypher_null_semantics.py/test_coalesce_replaces_missing_property sgraph/tests/test_cypher_null_semantics.py/build_model func_ref test→test regular
sgraph/tests/test_cypher_null_semantics.py/test_count_skips_missing_property sgraph/tests/test_cypher_null_semantics.py/build_model func_ref test→test regular
sgraph/tests/test_cypher_null_semantics.py/test_is_null_on_missing_property_after_with sgraph/tests/test_cypher_null_semantics.py/build_model func_ref test→test regular
sgraph/tests/test_cypher_null_semantics.py/test_is_null_on_missing_property_after_with sgraph/tests/test_cypher_null_semantics.py/names func_ref test→test regular
sgraph/tests/test_cypher_null_semantics.py/test_is_null_on_optional_match_after_with sgraph/tests/test_cypher_null_semantics.py/build_model func_ref test→test regular
sgraph/tests/test_cypher_null_semantics.py/test_is_null_on_optional_match_after_with sgraph/tests/test_cypher_null_semantics.py/names func_ref test→test regular
sgraph/tests/test_cypher_null_semantics.py/test_is_null_on_unwound_null sgraph/tests/test_cypher_null_semantics.py/build_model func_ref test→test regular
sgraph/tests/test_cypher_null_semantics.py/test_json_output_uses_null_for_missing_property sgraph/tests/test_cypher_null_semantics.py/build_model func_ref test→test regular
sgraph/tests/test_cypher_null_semantics.py/test_missing_value_in_result_is_pd_na sgraph/tests/test_cypher_null_semantics.py/build_model func_ref test→test regular
sgraph/tests/test_cypher_null_semantics.py/test_no_infer_string_deprecation_warning_leaks sgraph/tests/test_cypher_null_semantics.py/build_model func_ref test→test regular
sgraph/src> sgraph/cypher.py/SGraphCypherExecutor/exec sgraph/src> sgraph/cypher.py/_strings_as_object_dtype func_ref prod→prod regular

Removed dependencies (1)

from to type roles signal
sgraph/src> sgraph/cypher.py/_run_repl sgraph/src> sgraph/cypher.py/SGraphCypherExecutor func_ref prod→prod regular

Impacted files (1)

Unchanged files that directly depend on files changed in this PR - check them for behavioral impact. Grouped by changed file; sym ← caller pairs name the exact call sites, * marks a symbol whose lines changed in this PR:

changed file directly impacted dependents
sgraph/src/sgraph/cypher.py 1: sgraph/tests/test_cypher_numpy_compat.py (cypher_query, cypher_query ← test_to_float_and_to_string, cypher_query ← test_to_integer_in_where_and_return)

Suggested test targets

Impacted files that are test code — running or extending these covers the change most directly:

  • sgraph/tests/test_cypher_numpy_compat.py

Complete data

📄 Full report

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

@villelaitila
villelaitila merged commit 85b41da into softagram:main Nov 16, 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