Skip to content

Bump docstub to v0.7.0rc0 and fix errors (8) - #8028

Merged
stefanv merged 11 commits into
scikit-image:mainfrom
lagru:doctype-fixes-lagru
Jan 21, 2026
Merged

stefanv merged 11 commits into
scikit-image:mainfrom
lagru:doctype-fixes-lagru

Conversation

@lagru

@lagru lagru commented Jan 19, 2026 •

Copy link
Copy Markdown
Member

Description

@mkcor switching from roman numerals to (8) here in the title. 😅

Checklist

Release note

For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.

...

Summary by CodeRabbit

  • Chores

    • Pinned developer tooling to docstub==0.7.0rc0 and updated CI workflow allowances and build configuration.
  • Documentation

    • Standardized and clarified docstrings across the library: consistent type names, explicit array shapes/dtypes, refined parameter and return descriptions.

✏️ Tip: You can customize this high-level summary in your review settings.

@lagru
lagru requested a review from mkcor January 19, 2026 17:38
@lagru lagru added 🔧 type: Maintenance Refactoring and maintenance of internals 🧩 typing Type annotations, type checking, and stubs labels Jan 19, 2026
@coderabbitai

This comment was marked as outdated.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (9)
src/skimage/feature/_fisher_vector.py (1)

58-66: Fix parameter type description (list element type is wrong).

learn_gmm accepts a list of NumPy arrays, not a list of (tuple[int, int]). The new docstring contradicts the runtime checks and will mislead users. Recommend reverting to a list-of-arrays description.

🩹 Proposed docstring fix
-    descriptors : ndarray of shape (N, M) or list of (tuple[int, int])
+    descriptors : ndarray of shape (N, M) or list of ndarray of shape (Ni, M)
src/skimage/segmentation/active_contour_model.py (1)

69-70: Inconsistent docstring format in Returns section.

The Returns section still uses the old format (K, 2) ndarray while the Parameters section was updated to ndarray of shape (K, 2). For consistency with the PR's goal of standardizing docstring type annotations, this should also be updated.

📝 Suggested fix
     Returns
     -------
-    snake : (K, 2) ndarray
+    snake : ndarray of shape (K, 2)
         Optimised snake, same shape as input parameter.
src/skimage/transform/_geometric.py (7)

636-647: Same :cls: vs :class: issue as noted above.

Consider updating to :class: for proper Sphinx cross-referencing.


876-887: Same :cls: vs :class: issue as noted above.


1137-1148: Same :cls: vs :class: issue as noted above.


1655-1666: Same :cls: vs :class: issue as noted above.


2005-2016: Same :cls: vs :class: issue as noted above.


2386-2397: Same :cls: vs :class: issue as noted above.


343-354: Replace :cls: with :class: in Sphinx cross-reference.

The syntax :cls: is not a standard Sphinx role. The correct role for cross-referencing classes is :class:. This typo occurs in multiple locations (at least 8 times across _geometric.py and fits_plugin.py), so consider fixing all occurrences.

🤖 Fix all issues with AI agents
In `@src/skimage/data/_fetchers.py`:
- Line 1200: Fix the typographical error in the docstring for
nickel_solidification: change "ndarray of shap (11, 384, 512) and dtype uint16"
to "ndarray of shape (11, 384, 512) and dtype uint16" in the docstring where the
nickel_solidification dataset is documented.

In `@src/skimage/filters/ridges.py`:
- Around line 218-219: Update the docstring for the gamma parameter in
skimage.filters.ridges: change the Sphinx directive from ".. versionchanged::
0.18" to ".. versionchanged:: 0.20" so the adaptive-default behavior (None uses
half of the maximum Hessian norm) correctly cites the 0.20 release (PR `#6446`);
locate the directive in the docstring for the gamma parameter in the ridges
function and replace the version number only.

In `@src/skimage/io/_plugins/fits_plugin.py`:
- Around line 68-69: The Sphinx cross-reference uses the wrong role `:cls:` in
the docstring line "ic : :cls:`~.ImageCollection`" in
src/skimage/io/_plugins/fits_plugin.py; update the role to `:class:` so it reads
"ic : :class:`~.ImageCollection`" (and search for any other occurrences of
`:cls:` in that module and replace them similarly) to eliminate the Sphinx
warning.

In `@src/skimage/util/_montage.py`:
- Around line 65-67: The docstring for arr_out in src/skimage/util/_montage.py
uses K for both dimensions which is misleading for non-square grids; update the
shape explanation so W and Q are computed from ntiles_row and ntiles_col
respectively (e.g., state W = ntiles_row * (M + p) + p and Q = ntiles_col * (N +
p) + p) and mention the optional channel dimension C where applicable, editing
the arr_out description and the formula in the _montage module's docstring
(variables M, N, p, ntiles_row, ntiles_col, C) accordingly.
🧹 Nitpick comments (1)
src/skimage/data/_fetchers.py (1)

1108-1108: Minor inconsistency: dtype "float" vs "float64".

This return description uses dtype float while other similar descriptions in this file use explicit dtypes like uint8, uint16, float64. Consider using float64 for consistency with line 1014 (dtype float64).

📝 Suggested change
-    disp : ndarray of shape (500, 741, 3) and dtype float
+    disp : ndarray of shape (500, 741, 3) and dtype float64

Comment thread src/skimage/data/_fetchers.py Resolved
Comment thread src/skimage/filters/ridges.py Resolved
Comment thread src/skimage/io/_plugins/fits_plugin.py Resolved
Comment thread src/skimage/util/_montage.py Resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Comment thread src/skimage/draw/draw.py
Parameters
----------
shape : iterable of ints
shape : Iterable of int(s)

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.

Is the plural new in docstub v0.7?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, it's been around since version 0.3.0.

Yay or nay?

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.

Leaning towards nay... It's nice from a natural language perspective, I find, but from a programming-style perspective, it adds some clutter (even confusion?) for no additional information...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We could use it to differentiate a 1-element tuple from a one allowing an arbitrary length:

  • tuple of int -> tuple[int]
  • tuple of int(s) -> tuple[int, ...]

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/skimage/data/_fetchers.py (1)

1108-1113: Correct disparity map shape from (500, 741, 3) to (500, 741).

The documented shape (500, 741, 3) is incorrect. The disparity map should be 2D with shape (500, 741). Evidence from the codebase confirms this:

  1. The example at line 1111-1112 shows disp[10, 10] as a scalar: img_left[10, 10 + disp[10, 10]]
  2. The description states "each value describes the offset" (singular value per pixel)
  3. Usage in doc/examples/transform/plot_fundamental_matrix.py demonstrates 2D indexing with np.ravel_multi_index(disp_coords.T, groundtruth_disp.shape), where disp_coords are 2D image coordinates
  4. The shape (500, 741, 3) appears to be a copy-paste error from the img_left and img_right shapes documented immediately above

@mkcor mkcor 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.

Thanks, @lagru!

Comment thread src/skimage/feature/match.py Resolved
Comment thread src/skimage/filters/_rank_order.py Resolved
Comment thread src/skimage/filters/_window.py Resolved
Comment thread src/skimage/filters/ridges.py Resolved
Parameters
----------
ic : an iterable of images
ic : Iterable of ndarray

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.

... of ndarray(s) ? 😉

Comment thread src/skimage/util/_montage.py Resolved
Comment thread src/skimage/util/_montage.py Resolved
lagru and others added 4 commits January 20, 2026 13:06
These are deprecated and slated for removal in v0.27. No need to spend
time typing them. Revert previous changes to minimize diff.
Co-authored-by: Marianne Corvellec <[email protected]>
Co-authored-by: Marianne Corvellec <[email protected]>

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.github/workflows/typing.yml:
- Around line 40-43: The workflow step named "Install docstub" uses a
non-existent version spec "docstub~=0.7.0rc0" which will cause pip to fail;
update the pip install invocation in that step to use the available release
(e.g., "docstub==0.6.0") or confirm the intended target with maintainers and
adjust the version pin accordingly so the Install docstub step's run block uses
a valid package version.

In `@pyproject.toml`:
- Around line 60-63: The pinned dependency docstub==0.7.0rc0 in pyproject.toml
is not available on PyPI; update the dependency entry 'docstub' to a valid
release (e.g., docstub==0.6.0) or replace it with an appropriate source spec
(private index or local path) if a non-PyPI version is intended, and ensure the
[tool.docstub] configuration still applies to the chosen package source.

Comment thread .github/workflows/typing.yml Resolved
Comment thread pyproject.toml Resolved
arr_in : ndarray, shape (K, M, N[, C])
An array representing an ensemble of `K` images of equal shape.
fill : float or array-like of floats or 'mean', optional
fill : float or array_like of dtype float or Literal['mean'], optional

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.

A bit weird to have this syntax in here. Perhaps backtick quote mean or double-backtick quote mean?

Comment thread pyproject.toml
]


[tool.docstub]

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.

Nice.

@stefanv
stefanv merged commit ea547d3 into scikit-image:main Jan 21, 2026
@stefanv stefanv added this to the 0.27 milestone Jan 21, 2026
@lagru
lagru deleted the doctype-fixes-lagru branch January 21, 2026 12:24
FelipeCybis pushed a commit to FelipeCybis/scikit-image that referenced this pull request Jun 9, 2026
lagru added a commit that referenced this pull request Nov 9, 2026
Follows #8028. 

- Fixes a few docstub errors.
- Points docstub at `_skimage2` instead of `skimage2`, because the
latter is just an empty wrapper.
- Bumps docstub to v0.7.0rc1
- Adds a docstub plugin to override the dtype-union form as requested.
We decided in the meeting that we want to use
`ndarray of shape (M, N) and dtype in {uint8, uint16}` over `ndarray of
shape (M, N) and dtype (uint8 or uint16)`.

The form change introduce a few new errors. I'd like to address them in
a follow-up PR instead of here.

Co-authored-by: Matthew Brett <[email protected]>
Co-authored-by: Lars Grüter <[email protected]>
Co-authored-by: Stefan van der Walt <[email protected]>
Co-authored-by: Steven Silvester <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧩 typing Type annotations, type checking, and stubs 🔧 type: Maintenance Refactoring and maintenance of internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants