Skip to content

feat(schema): add pretty print helpers#1639

Draft
lmeyerov wants to merge 1 commit into
masterfrom
codex/issue-1633-schema-pretty
Draft

feat(schema): add pretty print helpers#1639
lmeyerov wants to merge 1 commit into
masterfrom
codex/issue-1633-schema-pretty

Conversation

@lmeyerov
Copy link
Copy Markdown
Contributor

@lmeyerov lmeyerov commented May 25, 2026

Closes #1633

Summary

  • Add experimental pretty() methods for GraphSchema, NodeType, EdgeType, and EdgeTopology with cypher, yaml, and compact formats.
  • Override schema dataclass __repr__ to use the compact Cypher-style renderer by default.
  • Add graphistry.schema.pretty_print_schema() and top-level graphistry.pretty_print_schema for ergonomic rendering.
  • Document usage in the GFQL schema guide and add anchored regression tests for all formats.

Sample output

cypher

(:Person {id: int64, name: string, age: int64})
(:Company {id: int64, name: string})
(:Person)-[:WORKS_AT {since: int64}]->(:Company)
(:Company)-[:CONTRACTS {fee: float64}]->(:Person)

yaml

strict: true
node_id_column: id
edge_columns:
  source: src
  destination: dst
nodes:
  Person:
    labels: Person
    properties:
      id: int64
      name: string
      age: int64
relationships:
  WORKS_AT:
    from: Person
    to: Company
    properties:
      since: int64

compact

GraphSchema(2 node types, 2 edge types, 7 properties)

LOC buckets

  • Production: +261 / -2, net +259 LOC
  • Tests: +135 / -1, net +134 LOC
  • Docs/changelog: +49 / -0, net +49 LOC

Compiler-plan surface touched

No. This is public schema text rendering only. It does not change schema dataclass fields, inference, serialization, binder/compiler behavior, route names, IR metadata, remote schema transport, or planner/verifier contracts.

Notes

  • Public viz/schema payload compatibility is not narrowed.
  • Arrow/GFQL dtype wrappers render as clean names such as int64 and string; non-null declared Arrow fields render with a compact ! suffix, e.g. int64!.
  • Cypher identifiers and YAML scalar names are escaped for non-identifier labels/properties.
  • DGX/RAPIDS validation skipped: no DataFrame execution, cuDF, GPU, or algorithm path changed.

Validation

  • python3 -m pytest -q graphistry/tests/compute/gfql/test_public_schema.py -> 28 passed
  • ./bin/ruff.sh graphistry/schema.py graphistry/__init__.py graphistry/tests/compute/gfql/test_public_schema.py -> passed
  • ./bin/typecheck.sh graphistry/schema.py graphistry/__init__.py -> passed
  • ./bin/check_docs_latex_unicode.sh -> passed
  • git diff --check -> passed
  • Review skill converged after wave-1 YAML escaping fix; waves 2 and 3 clean
  • Full PR CI green, including RTD preview: https://pygraphistry--1639.org.readthedocs.build/en/1639/

@lmeyerov lmeyerov force-pushed the codex/issue-1633-schema-pretty branch from 559990f to 469ae25 Compare May 25, 2026 17:50
@lmeyerov
Copy link
Copy Markdown
Contributor Author

lmeyerov commented May 25, 2026

Parking this PR for now. The pretty-printer surfaced a deeper schema-model question that should be decided first: #1644.

Specifically, per-entity declarations probably should not inherit the aggregate table nullable default. A declared NodeType("Person", {"id": int}) likely means Person.id is required/non-null for Person rows, while the merged nodes table column may still be nullable because it is fused across entity types.

Until #1644 is resolved, this PR should not encode nullability display conventions or merge as the canonical schema text surface. Options after #1644:

  • update the formatter to reflect the decided per-entity vs aggregate nullability semantics, or
  • remove nullability from default pretty output and keep it only in a more explicit/debug format.

CI is green and review skill had converged, but this is now semantically blocked, not technically blocked.

@lmeyerov lmeyerov marked this pull request as draft May 25, 2026 21:58
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.

feat(gfql): add pretty_print_schema() + compact __repr__ for GraphSchema/NodeType/EdgeType (LLM-friendly)

1 participant