Skip to content
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

A question regarding using input() #27

Open
biagiopalese opened this issue Feb 2, 2025 · 2 comments
Open

A question regarding using input() #27

biagiopalese opened this issue Feb 2, 2025 · 2 comments
Labels
s: question-answered t: question Further information is requested

Comments

@biagiopalese
Copy link

biagiopalese commented Feb 2, 2025

I was wondering if support for Python's input() function is currently part of your work on the quarto-pyodide extension, or if it might be possible to implement in the future?

I've attempted several workarounds without success, including:

  • Using JavaScript to create a custom pyodideInput function
  • Implementing async/await patterns with Promise-based input handling
  • Trying HTML input elements with JavaScript bridges to Python
  • Exploring setStdin configurations for Pyodide

The ability to use input() would greatly enhance the interactive capabilities of Python code in Quarto documents. If it's not currently feasible, could you perhaps suggest any alternative approaches that might work within the quarto-pyodide framework? Thank you in advance for creating this extension and for your support.

@coatless coatless added t: question Further information is requested s: question-answered labels Feb 3, 2025
@coatless
Copy link
Collaborator

coatless commented Feb 3, 2025

@biagiopalese not currently on my feature map; nor is it likely to be.

You probably want to look more closely at Jupyterlite, which supports this feature through asynchronous futures and embedded prompting.

A screenshot showing the cell

https://jupyter.org/try-jupyter/lab/

your_name = input("What's your name? ")

print(f"Hello there {your_name}")

@biagiopalese
Copy link
Author

@coatless I appreciate the prompt response. It does make sense, I was trying to move some teaching content from Jupiterlite to quarto/pyodide. However, input is not a deal breaker and thank you again for creating this great extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: question-answered t: question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants