Skip to content

Fix docstring mismatches in the Python bindings - #3948

Merged
angeloskath merged 1 commit into
ml-explore:mainfrom
ayaangazali:fix-binding-docstrings
Jul 30, 2026
Merged

Fix docstring mismatches in the Python bindings#3948
angeloskath merged 1 commit into
ml-explore:mainfrom
ayaangazali:fix-binding-docstrings

Conversation

@ayaangazali

Copy link
Copy Markdown
Contributor

Proposed changes

Four docstring fixes in python/src, all cases where the doc text disagrees with the binding it is attached to. Checked each against the compiled module after rebuilding.

  1. dequantize (ops.cpp): the Args: block listed mode last, after global_scale and dtype, but the signature has it before them. Anyone following the doc order positionally gets a TypeError:
wq, s, b = mx.quantize(mx.random.normal((64, 64)), 32, 4)
mx.dequantize(wq, s, b, 32, 4, "affine", None, None)   # signature order, fine
mx.dequantize(wq, s, b, 32, 4, None, None, "affine")   # doc order, TypeError
  1. pad (ops.cpp): documented as constant_value, but the keyword is constant_values, so the documented spelling raises TypeError: incompatible function arguments.

  2. rfftn (fft.cpp): the Returns: sentence was cut off at "The output" mid-thought. Completed it to match rfft and rfft2 ("The output data type will be complex."), which is also what it returns (complex64).

  3. FunctionExporter (export.cpp): fun:\mx.exporter`was missing the leading colon on the role, so it rendered as literal text instead of a link to:func:`mx.exporter``.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

(docstring text only, no tests; rebuilt CPU-only locally and confirmed the rendered docstrings)

Happy to split this into separate PRs if you would rather review them apart.


for transparency: freshman contributor here, and Claude Code helps me scan for this kind of doc/signature drift, but i ran the two TypeError cases above myself, diffed each docstring against its own nb::sig line, and rebuilt to check the strings render before opening this. tell me if any of the rewording should read differently.

@angeloskath angeloskath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@angeloskath
angeloskath merged commit 2263a6b into ml-explore:main Jul 30, 2026
24 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants