Skip to content

Document parameters missing from the API reference - #861

Merged
d-chambers merged 3 commits into
devfrom
docstring-params
Aug 11, 2026
Merged

Document parameters missing from the API reference#861
d-chambers merged 3 commits into
devfrom
docstring-params

Conversation

@d-chambers

Copy link
Copy Markdown
Contributor

Description

Several public functions have arguments in their signature that their Parameters section never documented, so the rendered API reference shows a signature and a parameter table that disagree. dc.write is the clearest example: the signature is write(patch_or_spool, path, file_format, ...) while the table starts at path, which reads as though every description is shifted by one argument.

Twelve of these are the leading patch/patch_or_spool/patches argument. That is an omission rather than a house style — 39 of the proc functions that take patch first already document it, and 12 did not.

The remaining gaps are ordinary ones:

  • scan_to_dfext, timestamp and progress (passed through to dc.scan, and documented there)
  • get_coordmax (min, start and stop were documented)
  • Patch.padsamples
  • CoordManager.drop_coordsarray
  • BaseCoord.get_slice_tuplerelative
  • examples.spool_to_directoryextension

One case ran the other way. BaseSpool.select documents the four keyword-only arguments the implementation accepts (_attrs, _coords, samples, relative), but the abstract method declared only **kwargs — the mismatch griffe reports as spool.py:295: Parameter '_attrs' does not appear in the function signature on every doc build. The abstract signature now matches the docstring and Spool.select; subclasses are unaffected at runtime.

No behavior changes: docstrings plus one abstract signature.

Found by auditing every callable in the documented API with inspect.signature against its numpydoc Parameters section; the audit now reports zero mismatches.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes.
  • documented the new feature with docstrings and/or appropriate doc page.
  • included tests. See testing guidelines.
  • added the "ready_for_review" tag once the PR is ready to be reviewed.

Every function here has arguments in its signature that its Parameters
section never listed, so the rendered reference page shows a signature and
a parameter table that disagree. Most are the leading `patch` argument,
which made the table look shifted by one: `write` starts at `path` while
its signature starts at `patch_or_spool`. The convention in the package is
to document it -- 39 proc functions already do -- so these were simply
omissions.

The rest are ordinary gaps: scan_to_df's pass-through ext/timestamp/
progress, get_coord's `max`, pad's `samples`, drop_coords' `array`,
get_slice_tuple's `relative`, and spool_to_directory's `extension`.

BaseSpool.select ran the other way: it documented the four keyword-only
arguments the implementation takes while the abstract signature declared
only **kwargs, which is also what griffe warns about on every doc build.
Give the abstract method the signature its docstring already describes.
@d-chambers d-chambers added the ready_for_review PR is ready for review label Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@d-chambers, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 6 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eee9821e-6f24-49eb-a713-0542c59d2e30

📥 Commits

Reviewing files that changed from the base of the PR and between 8a4f22e and 103ef0e.

📒 Files selected for processing (17)
  • dascore/constants.py
  • dascore/core/coordmanager.py
  • dascore/core/coords.py
  • dascore/core/spool.py
  • dascore/examples.py
  • dascore/io/core.py
  • dascore/io/index/catalog.py
  • dascore/proc/align.py
  • dascore/proc/basic.py
  • dascore/proc/coords.py
  • dascore/proc/detrend.py
  • dascore/proc/filter.py
  • dascore/proc/resample.py
  • dascore/proc/rolling.py
  • dascore/proc/units.py
  • dascore/utils/patch.py
  • dascore/utils/pd.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

`relative` resolves against the coordinate's minimum and maximum, not its
start and stop, which differ for a reversed coordinate. `max` is an exact
alias for the exclusive `stop`, so get_coord(min=0, max=10, step=1) yields
a coordinate whose maximum is 9. drop_coords empties the axes of dropped
coordinates to length zero rather than removing them, so the array keeps
its dimensionality.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0334bf0109

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread dascore/core/spool.py Outdated
Comment on lines +271 to +272
_attrs: dict | None = None,
_coords: dict | None = None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Widen the namespace selector annotations

When a caller uses the documented tagging forms such as _attrs="tag" or _coords=["sensor"], the implementation accepts them (and the selection-spec tests exercise both), but this public signature declares only dictionaries. Because dc.spool() and several readers are typed as returning BaseSpool, static type checkers will reject these valid API calls; annotate each parameter to include a name and a collection of names as well as the mapping form.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 103ef0e. Confirmed the tag forms are exercised by the selector-spec tests (_attrs="tag", _coords=["sensor"]) and accepted by resolve_selector_namespaces, which normalizes a str or collection alongside the mapping form. Added a namespace_select_type alias in constants and applied it to BaseSpool.select, Spool.select, PatchCatalog.select and the resolver itself, so the whole chain admits what the docstring promises.

Comment thread dascore/core/coords.py Outdated
Comment on lines +920 to +921
relative
If True, the select values are relative to the start (positive)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Describe relative offsets from the coordinate extrema

For a descending coordinate, start and stop are the first and last endpoints, but _get_relative_values always resolves nonnegative values from self.min() and negative values from self.max(). Consequently, this description promises the wrong endpoints for reverse-sorted coordinates; for example (2, -2) selects from min + 2 through max - 2, not offsets from the coordinate's start and stop. Document these as offsets from the minimum and maximum instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e44d314. Verified: _get_relative_values resolves nonnegative values from self.min() and negative from self.max(), so the description now says minimum/maximum rather than start/stop.

Comment thread dascore/core/coords.py
Comment on lines 2909 to +2910
The stopping value of an array, exclusive.
max

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Mark max as an exclusive stop alias

Calling this parameter the maximum value is incorrect because the implementation assigns it directly to the exclusive stop. For example, get_coord(start=0, max=10, step=1) contains values only through 9, and on descending ranges the value is not a maximum at all. Describe max solely as an alias for the exclusive stop bound so callers do not introduce an off-by-one error when constructing coordinates.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e44d314. Confirmed empirically that get_coord(min=0, max=10, step=1) equals the start/stop form and has a maximum of 9, so max is now described as an alias for the exclusive stop.

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c97545e) to head (103ef0e).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #861   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          176       176           
  Lines        19372     19276   -96     
=========================================
- Hits         19372     19276   -96     
Flag Coverage Δ
network 48.12% <100.00%> (-0.25%) ⬇️
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

`_attrs` and `_coords` take either a mapping of name -> selector or a
name/collection of names tagging bare kwargs, which is what the docstring
describes and what resolve_selector_namespaces implements; the annotations
admitted only the mapping, so a type checker rejected the documented
`select(tag="some*", _attrs="tag")` form. Name the accepted shape once in
constants and use it everywhere the selectors are passed down.
@d-chambers
d-chambers merged commit 6b875e5 into dev Aug 11, 2026
26 of 27 checks passed
@d-chambers
d-chambers deleted the docstring-params branch August 11, 2026 11:56
@d-chambers d-chambers removed the ready_for_review PR is ready for review label Aug 11, 2026
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.

1 participant