Qiskit / Qiskit/documentation

De-duplicate API images that are identical

Open
#2,525 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

infra 🏗️
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-api too 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.