python / python/cpython

Use new REPL for the "code" module

Offen
#119,512 4 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

stdlib topic-repl type-feature
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

Feature or enhancement

Proposal:

When installing Django in a Python 3.13 virtual environment and using Django's shell command, the old REPL is used.

It would be great if the code module supported the new REPL. From @ambv's reply in https://github.com/python/cpython/issues/119433#issuecomment-2130060062 it looks like this will be considered in Python 3.14.


I would also like to know what projects should do in the meantime. For example, I found a way to modify Django's shell command in one's own project to use the new REPL, by using this within a try-except block:

from _pyrepl.simple_interact import run_multiline_interactive_console
run_multiline_interactive_console()

Is this an acceptable workaround before Python 3.14 is released? Or should this function not be relied on, seeing as it's in an undocumented module?

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

https://github.com/python/cpython/pull/119433#pullrequestreview-2074755660

Linked PRs
  • gh-148261

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Überprüfung des Python-Code-Moduls und der referenzierten _pyrepl.simple_interact-Workaround-Lösung, und lies anschließend die verlinkte CPython-Diskussion und den PR gh-148261. Als abgeschlossen gilt die Ermittlung, wie das Code-Modul die neue REPL verwenden sollte, sowie die Klärung, ob der Workaround vor Python 3.14 geeignet ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
cli
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.