Skip to content
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

Add alt text to API docs #2408

Open
8 of 9 tasks
arnaucasau opened this issue Nov 29, 2024 · 10 comments
Open
8 of 9 tasks

Add alt text to API docs #2408

arnaucasau opened this issue Nov 29, 2024 · 10 comments
Assignees

Comments

@arnaucasau
Copy link
Collaborator

arnaucasau commented Nov 29, 2024

Issue

The API docs don't have alt text for their images, and we need to add it by modifying the Python files in the 9 APIs repos. Each repo has a linter that can be used to verify how many images fail to provide an alternative text.

Each repo's linter has an allowlist defined at the beginning of the script with a list of all the current files that contain an image without alt text. The linter can be found at tools/verify_image.py.

Instructions

  1. Go to the tools/verify_image.py script in each of the 9 APIs.
  2. Look at the ALLOWLIST_MISSING_ALT_TEXT list to find all the files with images without alt text.
  3. Remove the file you want to fix from the ALLOWLIST_MISSING_ALT_TEXT list.
  4. Open a terminal and go to the top-level folder of the repo.
  5. Run the script by executing python tools/verify_image.py to get all the images without alt text in the file.

Example of the output:

💔 Some images are missing the alt text

Errors found in qiskit_ibm_runtime/fake_provider/example.py:
- Error in line 34: .. plot::
- Error in line 55: .. image::
- Error in line 63: .. plot::

Alt text is crucial for making documentation accessible to all users. It should serve the same purpose as the images on the page, conveying the same meaning rather than describing visual characteristics. When an image contains words that are important to understanding the content, the alt text should include those words as well.

This means that the file qiskit_ibm_runtime/fake_provider/example.py has images defined in lines 34, 55, and 63 without alt text.

  1. Find the code lines in the file and add the option :alt: [your alt text] under the directive .. image:: or .. plot:: found in each line. The .. plot:: directive is sometimes used to run code that doesn't generate an image. In those cases the option :nofigs: should be added instead of :alt: [your alt text].
  2. Remove the filename from the ALLOWLIST_MISSING_ALT_TEXT list if all the images are fixed.

List of the API repos to check (with the new instructions, all APIs can be checked):

@javabster javabster added the needs triage 🤔 this issue needs to be prioritized by the docs team label Dec 2, 2024
@abbycross abbycross removed on hold ⏸️ needs triage 🤔 this issue needs to be prioritized by the docs team labels Dec 5, 2024
@beckykd beckykd self-assigned this Dec 9, 2024
@arnaucasau
Copy link
Collaborator Author

New Instructions! The linter is now installable using pip install and can be used in all the repos 🎉

  1. Open a terminal and install the alt text checker by running:
pip install git+https://github.com/Qiskit/documentation.git#subdirectory=scripts/image-tester
  1. Go to the top-level folder of the repo.
  2. Run the script by executing the following command:
sphinx-alt-text-validator -f [FolderToCheck]

where [FolderToCheck] is the folder name where our python files are located. Ex. qiskit_ibm_runtime for runtime or qiskit_addon_utils for qiskit-addon-utils

  1. Find the files and lines containing invalid images in the output of the previous command.

Example of the output:

💔 Some images are missing the alt text

Errors found in qiskit_ibm_runtime/fake_provider/example.py:
- Error in line 34: .. plot::
- Error in line 55: .. image::
- Error in line 63: .. plot::

Alt text is crucial for making documentation accessible to all users. It should serve the same purpose as the images on the page, conveying the same meaning rather than describing visual characteristics. When an image contains words that are important to understanding the content, the alt text should include those words as well.

This means that the file qiskit_ibm_runtime/fake_provider/example.py has images defined in lines 34, 55, and 63 without alt text.

  1. Add the option :alt: [your alt text] under the directive .. image:: or .. plot:: found in each line. The .. plot:: directive is sometimes used to run code that doesn't generate an image. In those cases the option :nofigs: should be added instead of :alt: [your alt text].

@beckykd
Copy link
Collaborator

beckykd commented Dec 10, 2024

Images in Qiskit missing alt text: qiskit-missing-alt-text.txt

@beckykd
Copy link
Collaborator

beckykd commented Dec 10, 2024

Images in Qiskit Runtime missing alt text:

  • Errors found in qiskit-ibm-runtime\qiskit_ibm_runtime\fake_provider_init_.py:

  • Error in line 34: .. plot::

  • Error in line 55: .. plot::

  • Error in line 63: .. plot::

  • Errors found in qiskit-ibm-runtime\qiskit_ibm_runtime\transpiler\passes\scheduling\dynamical_decoupling.py:

  • Error in line 56: .. plot::

  • Error in line 88: .. plot::

  • Errors found in qiskit-ibm-runtime\qiskit_ibm_runtime\transpiler\passes\scheduling_init_.py:

  • Error in line 51: .. plot::

  • Error in line 102: .. plot::

  • Error in line 137: .. plot::

  • Error in line 152: .. plot::

  • Error in line 176: .. plot::

  • Error in line 207: .. plot::

  • Error in line 226: .. plot::

  • Error in line 240: .. plot::

  • Error in line 256: .. plot::

  • Error in line 274: .. plot::

  • Error in line 294: .. plot::

  • Error in line 313: .. plot::

  • Error in line 328: .. plot::

  • Error in line 342: .. plot::

  • Error in line 363: .. plot::

  • Error in line 382: .. plot::

  • Error in line 406: .. plot::

@beckykd
Copy link
Collaborator

beckykd commented Dec 10, 2024

Qiskit Runtime updates: Qiskit/qiskit-ibm-runtime#2079

@beckykd
Copy link
Collaborator

beckykd commented Dec 11, 2024

Qiskit updates: Qiskit/qiskit#13555

@beckykd
Copy link
Collaborator

beckykd commented Dec 18, 2024

PR for OBP addon: Qiskit/qiskit-addon-obp#45

@beckykd
Copy link
Collaborator

beckykd commented Dec 18, 2024

PR for Cutting addon Qiskit/qiskit-addon-cutting#725

@beckykd
Copy link
Collaborator

beckykd commented Dec 18, 2024

PR for Utils addon: Qiskit/qiskit-addon-utils#64

@beckykd
Copy link
Collaborator

beckykd commented Dec 18, 2024

PR for MPF addon: Qiskit/qiskit-addon-mpf#43

@beckykd
Copy link
Collaborator

beckykd commented Dec 18, 2024

All repos are done; just waiting for approvals / merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

4 participants