Embedded interpreters: No way to extend `sys.path`
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Feature or enhancement
Proposal:
Setting up an embedded Python interpreter often involves augmenting sys.path with some application-specific subdirectories, so as not to pollute the system's normal Python installation.
Unfortunately, PyConfig only affords either replacing the default path wholesale, or leaving it as-is (via module_search_paths_set). There appears to be no way to augment sys.path with application-specific directories and no documented way to retrieve the default contents of sys.path.
A workable solution might be to enhance cfg.module_search_paths_set so that when it's set to 2 or 3, the application's paths shall be prepended / appended to sys.path instead of replacing it.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/embedding-how-do-i-extend-sys-path/75734
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit der PyConfig-Dokumentation und dem im Issue beschriebenen Verhalten von module_search_paths_set und lesen Sie anschließend die verlinkte Discourse-Diskussion zum bisherigen Design-Kontext. Legen Sie fest, wie anwendungsspezifische Pfade mit dem standardmäßigen sys.path kombiniert werden sollen und wie sich das dokumentierte API-Verhalten gestalten soll; zum Abschluss sollten eine abgestimmte Implementierung und die entsprechende Dokumentation oder Tests vorliegen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- backend
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100