python / python/mypy

Enhancement: Support Git Branch-Based Caching and Pre-Execution Commands

Aperta
#18,526 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Feature Request

Switching branches during development often causes mypy to invalidate its cache, leading to slow reanalysis. Additionally, branch-specific dependencies may differ, which can result in cache pollution if the environment isn't synchronized after switching branches.

Proposed Solutions

Branch-Specific Caching:

Introduce an option to include the Git branch name in the cache directory path. This would allow switching between branches (e.g., from branch-a to branch-b and back) without losing previously cached data, improving performance and reducing redundant analysis.

Pre-Execution Command:

Add an option to run a custom command before mypy execution. This would enable users to automatically sync dependencies, e.g. using uv pip sync requirements.txt. Running this command before mypy would ensure the environment matches the branch’s requirements, preventing cache corruption due to mismatched dependencies.

Benefits:

  • Faster mypy runs when switching branches.
  • Better isolation of cached data per branch.
  • Reduced risk of cache pollution from dependency mismatches.
  • Improved developer experience with automated environment checks.

Additional Context
If similar functionality exists, guidance on achieving this would be greatly appreciated.

Thank you for considering this feature request.

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

L’issue non indica file, test o punti di ingresso. Identifica innanzitutto dove vengono gestite la configurazione della cache di mypy e l’esecuzione dei comandi, quindi chiarisci il comportamento e l’ambito dei percorsi della cache specifici del branch e dei comandi precedenti all’esecuzione; il lavoro completato dovrebbe includere le opzioni concordate e la copertura per entrambe le funzionalità.

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

Valutazione

Stack tecnologico
python
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.