projection_planning.py is invisible to ruff, mypy and pyright

Aperta
#2,099 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start with graphistry/compute/gfql/cypher/projection_planning.py and lowering.py to understand the imports and circular dependency; then inspect the pyright baseline entry and run bin/ci/ci_pyright_guard.py. The issue proposes replacing the namespace copy with explicit imports and removing the file-wide suppressions, but leaves the dependency-design choice open. Done means the file has no reportUndefinedVariable findings and the three checkers can check it without those suppressions.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

graphistry/compute/gfql/cypher/projection_planning.py is 698 lines and 14 top-level functions that no static checker can see.

How

# mypy: ignore-errors
# ruff: noqa: F821
from graphistry.compute.gfql.cypher import lowering as _lowering

globals().update(vars(_lowering))

The module builds its namespace at import time by copying lowering's globals. Roughly fifty names arrive that way — Optional, Mapping, Any, Dict, List, cast, re, pd, plus the domain types (ASTObject, ASTEdge, CypherQuery, ExprNode, GFQLValidationError, _ProjectionPlan, ResultProjectionPlan, …) and helpers (_unsupported, lower_match_clause, _parse_row_expr, …).

No tool can follow that, so each was silenced in turn:

checker how it is silenced cost
ruff # ruff: noqa: F821 file-wide, all rules that depend on name resolution
mypy # mypy: ignore-errors file-wide, every error class
pyright not silenced — reports 195 reportUndefinedVariable baselined in bin/ci/ci_pyright_baseline.json

Those 195 are 195 of the 240 findings currently in the pyright ratchet. One file is 81% of the baseline, and none of its findings are real defects — they are artifacts of a namespace no checker can model.

Why it is shaped this way

lowering.py imports projection_planning lazily from inside five separate functions, which is the usual sign of a circular dependency being worked around. The globals().update(...) is the other half of that workaround: rather than importing what it needs, the module inherits its parent's entire namespace.

Why it is worth fixing

A file with zero static checking is where a typo, an unbound local or a stale import survives review. This is the module that plans Cypher RETURN/ORDER BY projection — not a peripheral one.

Suggested direction

Replace the namespace copy with explicit imports, breaking the cycle properly (a shared module for the types both files need, or moving the planning helpers into lowering if the split no longer earns its keep). Then drop both suppression comments and let the three checkers see it.

The ratchet gives an objective success measure: bin/ci/ci_pyright_guard.py should show this file's reportUndefinedVariable count going to zero, and --strict will lock each improvement as it lands.

Not urgent, but not free

Nothing is broken today. The cost is ongoing: every future change to this file is unreviewed by tooling, and the ratchet's headline number stays dominated by noise.

Context: the pyright gate landed in #2092; the baseline entry for this file was left visible rather than excluded precisely so fixing it shows up as slack under --strict.

Lingua principale
Python
Stelle
2.6k
Fork
229
Merge medio
1g 5h
PR unite (30g)
99

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di graphistry/pygraphistry

Tutte le issue di graphistry/pygraphistry

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.