microsoft / microsoft/vscode-python-environments

Feature Request: Easily Add Folder to PYTHONPATH from VS Code UI

Aperta
#735 5 commenti 16 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

feature-request needs community feedback
Lingua principale
TypeScript
Stelle
138
Fork
62
Merge medio
1g 4h
PR unite (30g)
35

Descrizione

Hi, I’m not sure if this belongs here or in [vscode-python](https://github.com/microsoft/vscode-python), but I’d like to request a more user-friendly way to add folders to the Python path in VS Code.

### Current Situation

- The `python.analysis.extraPaths` setting only affects IntelliSense, not the runtime `PYTHONPATH`.
- Using a `.env` file with `PYTHONPATH=path1;path2;path3` is unreliable (in my experience) and not user-friendly.
- **Creating a `.pth` file in `.venv/Lib/site-packages/` as below works, but is also tedious and not user-friendly.**
```
path1/src/
path2/src/
...
```

### Feature Proposal

It would be very helpful to have:
- A context menu command when right-clicking a folder (e.g., “Add to Python Path”)
- An accessible command in the Command Palette (`Ctrl+Shift+P`)
- A button in the python-environments extension UI (it would be very intuitive to have a small icon/button next to each venv in the list. Clicking this button could prompt the user to select a folder, and then automatically add that folder to the venv using the `.pth` method.)

This should add the folder to the Python path of the currently selected virtual environment in VS Code.

This would make managing the Python path much easier, especially for users coming from PyCharm, where this is a standard feature.

Thanks!

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 dell’implementazione; inizia determinando se questo rientra in vscode-python o vscode-python-environments e esaminando l’UI esistente degli ambienti e la registrazione dei comandi. Per considerarlo completato, sarebbe necessario aver definito l’ambito e disporre di un modo rivolto all’utente per aggiungere una cartella selezionata al percorso Python dell’ambiente virtuale attualmente selezionato.

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

Valutazione

Stack tecnologico
python, vscode
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
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.