python / python/mypy

Programmatic Access to Extract Type Information with mypy

Aperta
#15,890 1 commento 4 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

I'm currently working on a project where I need to analyze a Python codebase programatically to extract type information for several variables. As mypy is a robust type-checker, I am keen on utilizing it for this purpose.

Objective: My goal is to use mypy programmatically to analyze Python code and obtain type information for specific variables.

Approaches Considered: As mypy can function as a language server, I am thinking to set up a LSP client, initiating the mypy language server, and subsequently dispatching LSP requests to gather type data. However, I am not sure about the viability of this strategy.

Direct Utilization of mypy: I am curious if there's a simpler way to leverage it directly as a library format for Python code analysis and extract type information extraction.

Questions:

Is there a recommended way to do programmatic type extraction using mypy?
Are there any internal APIs or tools within mypy that could be leveraged for this purpose?

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

Inizia esaminando il mypy language server e l’approccio LSP-client proposto, quindi verifica se mypy espone un’interfaccia di libreria diretta per estrarre le informazioni sui tipi delle variabili. L’issue richiede un workflow supportato concreto e un ambito definito prima di poter iniziare l’implementazione; sarà completata quando sarà stato deciso e documentato un percorso di accesso programmatico.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.