microsoft / microsoft/vscode-python-environments

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

Ouverte
#735 5 commentaires 16 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

feature-request needs community feedback
Langage dominant
TypeScript
Étoiles
138
Forks
62
Merge moyen
1 j 4 h
PR mergées (30 j)
35

Description

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!

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

L’issue ne nomme aucun fichier, test ni point d’entrée de l’implémentation ; commencez par déterminer si cela relève de vscode-python ou de vscode-python-environments et examinez l’UI existante des environnements ainsi que l’enregistrement des commandes. Pour considérer le travail comme terminé, il faudrait que le périmètre soit défini et qu’il existe un moyen accessible à l’utilisateur d’ajouter un dossier sélectionné au chemin Python de l’environnement virtuel actuellement sélectionné.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python, vscode
Domaine
developer-experience, tooling
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.