Skip to content

colorsys module and functions are missing docstrings  #148330

@aiwonderland

Description

@aiwonderland

Bug report

Bug description:

Bug Report: colorsys module missing docstrings

Description

The colorsys module (Lib/colorsys.py) has no proper docstrings for the module itself or any of its 6 conversion functions.

  • Running help(colorsys) or help(colorsys.rgb_to_hsv) in Python shows no useful documentation—only the function signature and a generic "no docstring" message.
  • The module has only a short top comment (not a __doc__ string), and all functions lack parameter descriptions, return value ranges, input constraints, or exception notes.
  • The official library docs (Doc/library/colorsys.rst) exist separately but are not embedded in the code, so they don't appear in interactive help.

Expected behavior

  • The module should have a proper __doc__ string explaining its purpose, color spaces (RGB/YIQ/HLS/HSV), and value ranges.
  • Each function (rgb_to_yiq, yiq_to_rgb, rgb_to_hls, hls_to_rgb, rgb_to_hsv, hsv_to_rgb) should have a docstring with:
    • Parameter names and expected ranges (0.0–1.0 for most, YIQ I/Q can be negative)
    • Return value structure and ranges
    • Brief description of the conversion
    • Notes on edge cases (e.g., division by zero near white in hls conversions)

Example

>>> import colorsys
>>> help(colorsys.rgb_to_hsv)
Help on function rgb_to_hsv in module colorsys:

rgb_to_hsv(r, g, b)
    # No docstring here—only the signature

CPython versions tested on:

3.9, 3.14

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions