Skip to content

docs: add summary lines to 11 from_* file/format converter docstrings#4137

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

docs: add summary lines to 11 from_* file/format converter docstrings#4137
TaiSakuma wants to merge 3 commits into
scikit-hep:mainfrom
TaiSakuma:docs-from-formats-docstrings

Conversation

@TaiSakuma

Copy link
Copy Markdown
Member

Summary

Rolls the pilot from #3946 out to the 11 operations in the from_* file/format converters batch of #3980:

from_arrow, from_arrow_schema, from_parquet, from_feather, from_json, from_avro_file, from_safetensors, from_iter, from_buffers, from_regular, from_categorical.

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_arrow Converts an Apache Arrow array into an Awkward Array.
ak.from_arrow_schema Converts an Apache Arrow schema into an Awkward Form.
ak.from_parquet Reads data from a local or remote Parquet file or collection of files.
ak.from_feather Reads a Feather file as an Awkward Array (through pyarrow).
ak.from_json Reads JSON from a string, bytes, file, or URL into an Awkward Array.
ak.from_avro_file Reads an Avro file as an Awkward Array.
ak.from_safetensors Reads a safetensors file as an Awkward Array.
ak.from_iter Converts Python data into an Awkward Array.
ak.from_buffers Reconstitutes an Awkward Array from a Form, length, and memory buffers.
ak.from_regular Converts one or all regular axes into irregular ones.
ak.from_categorical Replaces categorical data with equivalent non-categorical data.

Notes for reviewers

  • ak.from_json's summary ("from a string, bytes, file, or URL") was composed because the original ("Converts a JSON string…") undersold the accepted sources.
  • ak.from_regular reads "one or all regular axes" to cover axis=None, matching the flatten precedent (and mirroring to_regular in the sibling PR).
  • ak.from_feather's summary fixes the grammar of the lead sentence ("an Feather" → "a Feather"); the original stays verbatim in the body. ak.from_avro_file's summary uses the accurate singular ("an Avro file"); the plural original stays in the body.
  • ak.from_safetensors had a pre-existing inline Returns: header; it was merged into the new structure without duplication.
  • Pre-existing, out of scope: ak_from_safetensors.py's _impl ImportError message says "ak.from_tensorflow" (code, not docstring).

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 Opus 4.8, 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 Opus 4.8 noreply@anthropic.com

@github-actions github-actions Bot added the type/docs PR title type: docs (set automatically) label Jun 13, 2026
@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 (0b54a0f).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
Files with missing lines Coverage Δ
src/awkward/operations/ak_from_arrow.py 100.00% <ø> (ø)
src/awkward/operations/ak_from_arrow_schema.py 100.00% <ø> (ø)
src/awkward/operations/ak_from_avro_file.py 80.95% <ø> (ø)
src/awkward/operations/ak_from_buffers.py 94.44% <ø> (ø)
src/awkward/operations/ak_from_categorical.py 100.00% <ø> (ø)
src/awkward/operations/ak_from_feather.py 100.00% <ø> (ø)
src/awkward/operations/ak_from_iter.py 92.00% <ø> (ø)
src/awkward/operations/ak_from_json.py 94.03% <ø> (ø)
src/awkward/operations/ak_from_parquet.py 93.86% <ø> (ø)
src/awkward/operations/ak_from_regular.py 94.11% <ø> (ø)
... and 1 more

@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_arrow An #ak.Array built from the given Apache Arrow array.
ak.from_arrow_schema An #ak.forms.Form built from the given Apache Arrow schema.
ak.from_parquet An #ak.Array read from the given local or remote Parquet file(s).
ak.from_feather An #ak.Array read from the given Feather file (through pyarrow).
ak.from_json An #ak.Array read from the given JSON (string, bytes, file, or URL).
ak.from_avro_file An #ak.Array read from the given Avro file.
ak.from_safetensors ak.Array or ak.layout.Content: An Awkward Array (or layout) reconstructed from the safetensors buffers.
ak.from_iter An #ak.Array built from the given Python data.
ak.from_buffers An #ak.Array reconstituted from a Form, length, and a collection of memory buffers, so that data can be losslessly read from file formats and storage devices that only map names to binary blobs (such as a filesystem directory).
ak.from_regular An array with one or all regular axes converted to irregular (var) axes.
ak.from_categorical An array with categorical data replaced by the equivalent non-categorical data (by removing the label that declares it as such).

TaiSakuma and others added 3 commits June 30, 2026 18:37
Add a Google-style one-line summary and `Returns:`/`Examples:` section
headers to the 11 from_* file/format converters in
`src/awkward/operations/`: from_arrow, from_arrow_schema, from_parquet,
from_feather, from_json, from_avro_file, from_safetensors, from_iter,
from_buffers, from_regular, from_categorical.

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 Opus 4.8 <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-formats-docstrings branch from 4203ce2 to 0b54a0f Compare June 30, 2026 22:44
@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/PR4137

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.

1 participant