Consider adding a check for notebook (and image?) file size
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 106
- Forks
- 223
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 72
Description
https://github.com/Qiskit/documentation/pull/1673 is an example of an enormous file size we didn't realize. That has two major downsides:
- Makes the site slower for users to access, especially when they have slow Internet
- Slows down next.js's build process
I think https://github.com/Qiskit/documentation/issues/1672 may help address this. But either way, we may want to add a check that file sizes don't cross a threshold, e.g. >400MB. This would be at least for Jupyter notebooks, but maybe also for dedicated image files.
The allowlist mechanism should set new thresholds, e.g. (my-file.ipynb, 600) to set a threshold of 600MB.
FYI: how to reduce Jupyter notebook image size
Often PNGs are smaller than SVGs:
# Don't use SVGs for this file because the images are too large,
# and the SVGs are much larger than their PNGs equivalents.
%config InlineBackend.figure_format='png'
You can reduce the resolution of Matplotlib figures. However, this often makes the image less useful and I think it tends to be better to instead set figsize:
import matplotlib
matplotlib.rcParams["figure.dpi"] = 100
You can sometimes set figsize directly in Qiskit SDK:
# We set `figsize` to a smaller size to make the documentation website faster
# to load. Normally, you do not need to set the argument.
plot_gate_map(backend, figsize=(4, 4))
If figsize is not exposed, then you can change the returning figure:
fig = plot_circuit_layout(isa_circuit, backend=backend)
fig.set_size_inches(0.5 * fig.get_size_inches())
fig
One of the other techniques is to see if any of the images can be removed entirely. Are they pulling their weight?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review pull request 1673 and issue 1672 first, then locate the existing allowlist mechanism in the documentation project. Define checks for notebook and possibly image file sizes, including per-file thresholds such as (my-file.ipynb, 600), and verify that oversized files are rejected while allowlisted thresholds work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, next.js
- Domain
- build-system, documentation, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100