Repository navigation
Bump docstub to v0.7.0rc0 and fix errors (8) - #8028
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
# Conflicts: # .github/workflows/typing.yml
There was a problem hiding this comment.
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_gmmaccepts 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) ndarraywhile the Parameters section was updated tondarray 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.pyandfits_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 floatwhile other similar descriptions in this file use explicit dtypes likeuint8,uint16,float64. Consider usingfloat64for 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
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
| Parameters | ||
| ---------- | ||
| shape : iterable of ints | ||
| shape : Iterable of int(s) |
There was a problem hiding this comment.
Is the plural new in docstub v0.7?
There was a problem hiding this comment.
No, it's been around since version 0.3.0.
Yay or nay?
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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, ...]
There was a problem hiding this comment.
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:
- The example at line 1111-1112 shows
disp[10, 10]as a scalar:img_left[10, 10 + disp[10, 10]]- The description states "each value describes the offset" (singular value per pixel)
- Usage in
doc/examples/transform/plot_fundamental_matrix.pydemonstrates 2D indexing withnp.ravel_multi_index(disp_coords.T, groundtruth_disp.shape), wheredisp_coordsare 2D image coordinates- The shape
(500, 741, 3)appears to be a copy-paste error from theimg_leftandimg_rightshapes documented immediately above
| Parameters | ||
| ---------- | ||
| ic : an iterable of images | ||
| ic : Iterable of ndarray |
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]>
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
A bit weird to have this syntax in here. Perhaps backtick quote mean or double-backtick quote mean?
| ] | ||
|
|
||
|
|
||
| [tool.docstub] |
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]>
Description
@mkcor switching from roman numerals to
(8)here in the title. 😅Checklist
./doc/examplesfor new featuresRelease 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
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.