Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Users to Override stdin when loading Pyodide #502

Closed
3 tasks done
JeffersGlass opened this issue Jun 8, 2022 · 0 comments
Closed
3 tasks done

Allow Users to Override stdin when loading Pyodide #502

JeffersGlass opened this issue Jun 8, 2022 · 0 comments
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

Comments

@JeffersGlass
Copy link
Member

Checklist

  • I added a descriptive title
  • I searched for other feature requests and couldn't find a duplicate (including also the type-feature tag)
  • I confirmed that it's not related to another project are area (see the above section)

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?

@JeffersGlass JeffersGlass added needs-triage Issue needs triage type: feature New feature or request labels Jun 8, 2022
@marimeireles marimeireles added the backlog issue has been triaged but has not been earmarked for any upcoming release label Oct 4, 2022
@pyscript pyscript locked and limited conversation to collaborators Feb 12, 2023
@marimeireles marimeireles converted this issue into discussion #1181 Feb 12, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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
Projects
None yet
Development

No branches or pull requests

2 participants