-
Notifications
You must be signed in to change notification settings - Fork 86
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
Investigate storing notebook images as files, rather than inline #1672
Comments
Update: Frank thinks this will be non-trivial to do via Jupyter itself. One complication with storing the image as a file path is we still need to render the file, so the author would need to write code to save it and then load it to display. Frank had an idea that we could explore adding a script during the closed source sync that extracts out the images from the notebook, saves them in files, and updates the notebook to point to them. Given that complexity and that the pain point isn't that bad, we think this is low priority. |
I agree with Frank's assessment: there is no easy way to have it so that we always save an image to a file without requiring writing code for it. https://discourse.jupyter.org/t/cell-magic-to-save-image-output-as-a-png-file/11906/4 and https://discourse.jupyter.org/t/any-way-to-automatically-save-some-outputs-as-separate-files/17651. Jupytext's idea of paired notebooks is interesting to decouple inputs from outputs, but it still requires having an .ipynb file for outputting the outputs. We could add a post-process step in qiskit/documentation to extract the outputs of a Jupyter notebook and save them in other files. However, I don't think we should pursue it. Downsides:
-- Instead, I agree with Frank's suggestion that this type of post-process step should happen in closed source when we sync the open source content. There, no humans are manually editing the notebook file so we could split out the image output from the cell into the dedicated files. Then, we could use Next.js's This post-processing would complicate the download notebooks button because our local copy of the Jupyter notebook in the closed source repo would have had its images stripped out. However, I think it is perfectly acceptable for the downloaded notebook to be "clean" and not have any outputs at all inside. The user can refer back to the website or qiskit/documentation GitHub to see the outputs we have. So, our code for downloading notebooks should strip all outputs, both images (already removed during the open source sync process) and text. -- We need to add alt text to the images. I think we have two options:
-- Update Dec 26, 2024: Consider if #2520 changes anything given that we now expect users for MDX files to have a semi-manual step to use AVIF images. |
Potential benefits to explore:
yarn dev
andyarn build
(with static site builder for preview app) fasterLook at our largest notebook files when investigating, such as by running
dust guides/
.The text was updated successfully, but these errors were encountered: