This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Allow Users to Override stdin when loading Pyodide #502
Labels
backlog
issue has been triaged but has not been earmarked for any upcoming release
needs-triage
Issue needs triage
type: feature
New feature or request
Checklist
type-feature
tag)What is the idea?
Since version 0.18.0, Pyodide allows the user to override the default requests from stdin. I propose adding an option to allow the user to define a different typescript/javascript function to use for stdin, perhaps awaiting input from a given
<input>
?Why is this needed
The current behavior of using input() within a
py-script
tag is to create a browser prompt with the given text. This is a good default, but perhaps not ideal in all situations, and doesn't "feel" how input() does work working, say, in a REPL.What should happen?
The user should be able to (somehow) specify a Javascript function, defined before the Pyodide runtime loads, to use for stdin.
Additional Context
Presumably this is a relatively straightforward modification to loadInterpreter(), but as to where the user would actually configure such an option I'm not sure.
Or perhaps it's as simple as defining a javascript function with a specific name, then, if that function is available in the js global scope importing that via
from js import...
and using that in the loadPyodide() call?The text was updated successfully, but these errors were encountered: