De-duplicate API images that are identical
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 106
- Forks
- 223
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 72
Description
Our Git repo size is very large. This is mostly from blobs, like our images and videos.
It appears some of the images are identical, such as https://github.com/Qiskit/documentation/blob/main/public/images/api/qiskit/depth.gif. So, it's very inefficient for us to duplicate the same image ~25 times.
An original idea was for historical API docs to use the asset from latest if the blob is bit-for-bit identical. However, there is an edge case there if a new version of latest removes the blob, then all the historical docs are pointing to an asset that no longer exists.
Instead, we could use a folder public/images/api/qiskit/common. If a blob appears in >1 version, we store the blob in /common.
- There is a risk that the same blob filename has multiple versions over time, e.g. version A is in Qiskit 0.19-1.1, then version B is in Qiskit 1.2-1.3+. So, we should probably put something in the file name as a suffix, like the number of bytes or a hash.
- Be careful that the algorithm doesn't slow down
gen-apitoo much. To determine whether an image has a duplicate, we need to inspect every other API version, including the new version we're currently generating- Ideally we can do the de-duplication as part of
gen-api, rather than a standalone process we sometimes manually run to post-process. With Git repo size, we need to avoid introducing the binary at all because once a blob is saved to Git, it is there forever unless we force push. - If we set up a new de-duplication, we need to remember to rewrite the link in the historical API version that now has a common blob
- Ideally we can do the de-duplication as part of
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
Trace the gen-api entry point and how it writes assets under public/images/api/qiskit across historical API versions. Define a deduplication pass that detects bit-for-bit duplicates, stores shared blobs in common with collision-safe names, rewrites historical links, and avoids adding duplicate binaries before generation completes.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100