Frequently Asked Questions

Published

February 9, 2024

Modified

September 6, 2024

Welcome to our Frequently Asked Questions (FAQ) page, your go-to resource for finding answers to common queries about the quarto-pyodide extension. If you can’t find the answer you’re looking for, don’t hesitate to reach out to our community for additional support by opening a question or a bug report on the issue tracker.

General Information

What is Quarto?

Quarto is a versatile, open-source scientific and technical publishing system. Documents can be authored that contain prose alongside of dynamic content generated by running Python, R, Julia, and Observable code.

What is the quarto-pyodide extension for Quarto?

The quarto-pyodide extension is a tool designed to embed interactive Python cells within an HTML document using Pyodide. This is possible because Pyodide is a Python runtime that runs entirely in the browser.


How Quarto Extension Works

How does the Quarto extension work?

The Quarto extension works by providing a convenient syntax to embed Python code cells directly within a Quarto document. These Python cells are then executed using Pyodide, and the results are displayed directly in the HTML document. This allows for interactive and dynamic content creation.

What are the key features of the Quarto extension?

The key features of the Quarto extension include:

  • Seamless integration of Python code within an HTML document.
  • Interactive execution of Python cells using Pyodide.
  • Real-time display of Python code outputs, including plots and visualizations.
  • Support for data analysis, scientific computing, and interactive storytelling.

Installation

How do I install the Quarto extension?

To install the Quarto extension, please see our installation page.

Packages

Can I use external libraries and packages in my Python cells?

Yes, you can use external libraries and packages within your Python cells. Pyodide includes a wide range of pre-installed libraries. These libraries can be downloaded and used on the fly once they are detected in an import statement.

You can also install additional packages by using the micropip package loaded at the start of each Pyodide session. These packages can either be pure Python packages (denoted by *py3-none-any.whl on PyPI) or Python packages compiled for Pyodide (denoted by *-cp310-cp310-emscripten_3_1_27_wasm32.whl that require a specific Python and Emscripten versions). For instance, the following will download and install the seaborn visualization library.

import micropip
micropip.install("seaborn")

Once done, please make sure to import the package:

import seaborn as sns

More details can be found on Pyodide’s Loading package documentation.

Sharing Documents

Can I share my Quarto document with others who may not have Python installed?

Yes, one of the advantages of using Pyodide is that it runs entirely in the browser, eliminating the need for users to have Python installed locally. You can easily share your Quarto document with others, and they can interact with the embedded Python cells directly in their web browser.

Documentation and Resources

Where can I find more documentation and examples for the Quarto extension?

You can find additional documentation and examples on this website. Moreover, you can learn more about Quarto by visiting their documentation website at Quarto. Additionally, you can explore the Pyodide documentation for more information on Python in the browser.

Limitations and Considerations

Are there any limitations to using Pyodide with the Quarto extension?

While Pyodide is a powerful tool, there are some limitations. Not all Python packages are available in Pyodide, and performance may vary for computationally intensive tasks. However, for a wide range of data analysis and visualization tasks, Pyodide and the Quarto extension provide a robust solution.

How does the Quarto extension differ from other similar libraries like pyscript and Thebe?

While Pyscript and Thebe also provide solutions for embedding interactive code in HTML documents, the Quarto extension distinguishes itself by leveraging Pyodide directly. When compared to Thebe, the Pyodide approach places the computation on the users computer through additional data needing to be downloaded. With respect to Pyscript, the pyodide approach simplifies the feature set present to allow for greater customization. The choice between these tools may depend on specific use cases and preferences.

Important

This Quarto extension is open source software and is not affiliated with Posit, Quarto, or Pyodide. The extension is at best a community effort to simplify the integration of Pyodide inside of Quarto generated documents.