python / python/mypy

--bazel not using relative path in cache files for imports

Aperta
#16,996 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Bug Report

if i create a python file file_a.py and a file file_b.py and i make file_b import file_a and i the run mypy --bazel file_b.py, then the paths in the meta.json and data.json files are relative in the cache files for file_b but absolute in cache files for file_a. I would expect mypy to use relative paths everywhere in bazel mode.

If I run directly on file_a (mypy --bazel file_a.py) i get relative paths in the cache files for file_a.

To Reproduce

Create file_a.py and file_b.py as described above, run mypy --bazel file_b.py.

Expected Behavior

Relative paths in all produced cache files. Also same hash and interface hash in the cache files for file_a produced by running on file_b that imports file_a, as if I had run directly on file_a.

Actual Behavior

Absolute path on cache files for imports. Also differing hash and interface hash of the cache files, if run on as an import vs. run on directly.

Your Environment

  • Mypy version used: 1.8.0 (Same behavior with other versions)
  • Mypy command-line flags: --bazel
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.11 (Same behavior with other versions)

Guida per i contributori

Apri la 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.

Direzione di ricerca

Riproduci il problema facendo importare file_b.py a file_a.py ed eseguendo mypy --bazel file_b.py, quindi confronta i file di cache meta.json e data.json con quelli prodotti eseguendo direttamente su file_a.py. Il lavoro è completato quando le cache dei file importati usano percorsi relativi e hanno lo stesso hash e lo stesso hash dell’interfaccia delle cache dell’esecuzione diretta.

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

Valutazione

Stack tecnologico
python
Ambito
build-system
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.