Skip to content

fix(plotter): raise TypeError on extra args to nodes()/edges() with DataFrame - #2203

Open
Lay-quq wants to merge 1 commit into
graphistry:masterfrom
Lay-quq:contrib/graphistry__pygraphistry__398
Open

Lay-quq wants to merge 1 commit into
graphistry:masterfrom
Lay-quq:contrib/graphistry__pygraphistry__398

Conversation

@Lay-quq

@Lay-quq Lay-quq commented Oct 19, 2026

Copy link
Copy Markdown

Summary

Problem

nodes() / edges() only forward extra positional/keyword arguments when the data argument is a callable. When given a DataFrame (or any other non-callable), extra arguments were silently dropped. For example, graphistry.nodes(df, 'id', point_title='some_col') succeeded but left point_title unbound.

Change

  • PlotterBase.nodes() / PlotterBase.edges() with non-callable data now raise TypeError naming the unexpected positional and/or keyword arguments.
  • When an unexpected keyword is a bind() binding name (e.g. point_title, edge_title), the message suggests using .bind(...) instead. Misspelled / unknown names do not get that hint.
  • The callable path (argument forwarding) and bind() are unchanged. Formal parameters such as node=, source=, destination=, edge= are unaffected, as is nodes(None).
  • Module-level graphistry.nodes() / graphistry.edges() delegate to PlotterBase, so they behave the same; both entry points are tested.

⚠️ Breaking / behavior change

Calls that previously silently ignored extra arguments now raise TypeError. This is recorded under ### Breaking 🔥 in the [Development] section of CHANGELOG.md.

Evidence that existing code relied on the silent behavior: graphistry/tests/compute/test_hop_column_conflicts_solution.py called .edges(edges_df, 'src', 'dst', src_renamed='id', dst_renamed='id'). edges() has no such parameters, so they were silently dropped. Unmodified, this test now fails with edges() got unexpected keyword argument(s) 'src_renamed', 'dst_renamed'. In this PR only those two arguments were removed (and an inaccurate comment on that line corrected); the test's intent is unchanged and it passes on both base and head. A repo-wide search for keyword calls to .nodes(...) / .edges(...) found no other such usages, and no other existing test changed outcome.

Non-goals

Validation

  • Local lint/type/tests run for touched scope
  • CI is green (not yet run at time of opening)

Local results (Python 3.12, pip install -e .[test]):

  • New TestNodesEdgesExtraArgs in graphistry/tests/test_plotter.py (11 tests, covering both PlotterBase and module-level entry points): on base 0b6f88d8 8 failed / 3 passed; on this branch 11 passed.
  • Full pytest, run in the style of bin/test-minimal.sh plus the GFQL tests (modules requiring optional dependencies or network skipped):
    • base: 10359 passed / 8730 skipped / 0 failed
    • head: 10370 passed / 8730 skipped / 0 failed (+11 = the new tests)
  • bin/lint.sh: pass
  • bin/typecheck.sh (mypy): pass

Note

Extra positional arguments are shown via repr in the error message, which can be long if a DataFrame is passed positionally. Happy to truncate or adjust the message if you prefer.

Cypher Frontend CI Evidence (when PR touches cypher frontend / IR scope)

N/A — this PR does not touch the cypher frontend / IR scope.


AI disclosure: This change was produced with AI assistance (implementation and tests), then independently reviewed and tested by a separate AI review step before submission.

nodes() and edges() only forward extra positional/keyword arguments when
the data argument is a callable. For a DataFrame they were silently
dropped, so e.g. graphistry.nodes(df, 'id', point_title='c') left
point_title unbound. Raise TypeError naming the unexpected arguments,
and suggest .bind(...) when a keyword is a binding name.

test_hop_column_conflicts_solution passed src_renamed/dst_renamed to
edges(), which were ignored; drop them so the test keeps its intent.

Refs graphistry#398

This branch has not been deployed

No deployments
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.

1 participant