cli: decide on an output layer before enabling ruff T201

Aperta
#736 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 the Ruff T201 findings and the output-heavy files named in the issue, especially src/vip/auth/apikey.py, src/vip/auth/workbench.py, src/vip/auth/flows.py, and the cli package. Compare the existing stdout and stderr behavior across auth, install, and CLI entry points before choosing the output-layer design. Done means the decision is implemented, call sites are migrated, output behavior remains intentional, and T201 can be enabled without broad noqa coverage.

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

Descrizione

enhancement

Summary

VIP has no output abstraction: no logging-to-console setup, no rich.Console, no click.echo. print() is the CLI and interactive-auth output layer. Ruff's T201 fires 100 times on origin/main (ruff 0.15.0), 91 of them in src/vip: the auth/ package 49 (auth/apikey.py 28, auth/workbench.py 7, auth/flows.py 5, auth/cache.py 4, auth/scheme.py 4, auth/browser.py 1), the cli/ package 26, install/runner.py 11, idp.py 2, and one each in install/playwright.py, plugin/results.py, and proxy.py.

What's wrong

Almost all of these prints are intentional user-facing output. For example, most of auth/apikey.py's use the >>> prefix for interactive-auth mint/diagnostic progress, and auth/browser.py:216 warns that an API key could not be deleted. Enabling T201 as-is would mean about 90 # noqa: T201 markers and would not separate real output from a stray debug print. Output formatting also has no single place, so messages cannot be quieted, redirected to stderr consistently, or captured in tests without monkeypatching print.

What to do

Design a thin vip.output wrapper (or adopt logging with a console handler) that owns stdout/stderr choice and verbosity, and migrate the call sites. Once that lands, enable T201 so new bare prints are caught. This is a design decision first and a lint ratchet second.

Origin

Flagged by a typing/lint review of the codebase. An earlier candidate example of a "debug leftover" print turned out, on re-check, to be a deliberate warning rather than debug output. That supports treating this as a design question rather than a cleanup.

Lingua principale
Python
Stelle
8
Fork
1
Merge medio
2g 2h
PR unite (30g)
33

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

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 posit-dev/vip

Tutte le issue di posit-dev/vip

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.