Skip to content

docs: add summary lines to 8 from_* array-library converter docstrings - #4136

Open
TaiSakuma wants to merge 3 commits into
scikit-hep:mainfrom
TaiSakuma:docs-from-arraylib-docstrings
Open

docs: add summary lines to 8 from_* array-library converter docstrings#4136
TaiSakuma wants to merge 3 commits into
scikit-hep:mainfrom
TaiSakuma:docs-from-arraylib-docstrings

Conversation

@TaiSakuma

Copy link
Copy Markdown
Member

Summary

Rolls the pilot from #3946 out to the 8 operations in the from_* array-library converters batch of #3980:

from_numpy, from_cupy, from_jax, from_torch, from_tensorflow, from_raggedtensor, from_dlpack, from_rdataframe.

Each docstring now has:

  • A one-line summary on the opening """.
  • Returns: and Examples: section headers (the latter only where examples exist).

Original body text is preserved; only structural edits are applied. The summary lines were reviewed against the checklist posted in #3980.

Summary lines

Operation Summary
ak.from_numpy Converts a NumPy array into an Awkward Array.
ak.from_cupy Converts a CuPy array into an Awkward Array.
ak.from_jax Converts a JAX Array into an Awkward Array.
ak.from_torch Converts a PyTorch Tensor into an Awkward Array.
ak.from_tensorflow Converts a TensorFlow Tensor into an Awkward Array.
ak.from_raggedtensor Converts a TensorFlow RaggedTensor into an Awkward Array.
ak.from_dlpack Converts a DLPack-aware array into an Awkward Array.
ak.from_rdataframe Converts ROOT RDataFrame columns into an Awkward Array.

Notes for reviewers

  • All 8 summaries are verbatim lifts of the existing lead sentences, which already matched the mirrored phrasing contract with the to_* siblings ("Converts a/an into an Awkward Array.").
  • Pre-existing quirk left verbatim: ak_from_jax.py's "See also" line references #ak.from_jax itself (likely meant #ak.from_cupy).

Test plan

  • pre-commit passes locally on the modified files (ruff check, ruff format, codespell, mypy).
  • Mechanical validation: code outside docstrings byte-identical; Args: blocks and doctests byte-identical; no original narrative text lost.
  • Sphinx docs build cleanly on CI.
  • Rendered docstrings spot-checked in the docs preview.

Part of #3980. Draft for initial review; will mark ready once CI passes and the preview is checked.

AI assistance disclosure

Drafted with Claude Code: summaries drafted by Claude Sonnet 4.6, adversarially verified against the implementations by independent Claude Opus 4.8 agents, mechanically validated (docstring-only changes, original text preserved), and reviewed by a human before submission.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.74%. Comparing base (722a1b9) to head (a75f25f).
⚠️ Report is 58 commits behind head on main.

Additional details and impacted files
Files with missing lines Coverage Δ
src/awkward/operations/ak_from_cupy.py 100.00% <ø> (ø)
src/awkward/operations/ak_from_dlpack.py 70.00% <ø> (ø)
src/awkward/operations/ak_from_jax.py 100.00% <ø> (ø)
src/awkward/operations/ak_from_numpy.py 100.00% <ø> (ø)
src/awkward/operations/ak_from_raggedtensor.py 22.72% <ø> (ø)
src/awkward/operations/ak_from_rdataframe.py 92.00% <ø> (ø)
src/awkward/operations/ak_from_tensorflow.py 27.58% <ø> (ø)
src/awkward/operations/ak_from_torch.py 29.16% <ø> (ø)

@github-actions github-actions Bot added the type/docs PR title type: docs (set automatically) label Jun 13, 2026
@TaiSakuma

Copy link
Copy Markdown
Member Author

Follow-up per @ikrommyd's review on #4130: the Returns: sections now describe the returned object (a noun phrase) rather than restating the operation. Final Returns: lines for this batch:

Returns

Operation Returns
ak.from_numpy An #ak.Array built from the given NumPy array.
ak.from_cupy An #ak.Array built from the given CuPy array.
ak.from_jax An #ak.Array built from the given JAX array.
ak.from_torch An #ak.Array built from the given PyTorch tensor.
ak.from_tensorflow An #ak.Array built from the given TensorFlow Tensor.
ak.from_raggedtensor An #ak.Array built from the given TensorFlow RaggedTensor.
ak.from_dlpack An #ak.Array built from the given DLPack-aware array.
ak.from_rdataframe An #ak.Array built from the given ROOT RDataFrame columns.

TaiSakuma and others added 3 commits June 30, 2026 18:39
Add a Google-style one-line summary and `Returns:`/`Examples:` section
headers to the 8 from_* array-library converters in
`src/awkward/operations/`: from_numpy, from_cupy, from_jax, from_torch,
from_tensorflow, from_raggedtensor, from_dlpack, from_rdataframe.

Follows the pilot in scikit-hep#3946 on `ak.flatten`. Original body text is
preserved; only structural edits are applied.

Refs scikit-hep#3980.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…#3980.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tion. Refs scikit-hep#3980.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@TaiSakuma
TaiSakuma force-pushed the docs-from-arraylib-docstrings branch from 674f1fc to a75f25f Compare June 30, 2026 22:42
@TaiSakuma
TaiSakuma marked this pull request as ready for review June 30, 2026 22:54
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

The documentation preview is ready to be viewed at http://preview.awkward-array.org.s3-website.us-east-1.amazonaws.com/PR4136

@TaiSakuma
TaiSakuma requested a review from ikrommyd July 10, 2026 18:51
@TaiSakuma
TaiSakuma requested review from ariostas and removed request for ikrommyd July 21, 2026 20:13

See also #ak.to_cupy, #ak.from_numpy and #ak.from_jax.
Returns:
An #ak.Array built from the given CuPy array.

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.

does it wrap the cupy array or copy it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/docs PR title type: docs (set automatically)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants