Skip to content

Commit fbe715b

Browse files
authored
Merge branch 'main' into docs-masked-array
2 parents 07deb8f + dce8cc5 commit fbe715b

File tree

93 files changed

+805
-844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+805
-844
lines changed

.coderabbit.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
reviews:
2+
profile: "chill" # "assertive" — more nitpicky
3+
review_status: false
4+
review_details: false
5+
high_level_summary: false
6+
request_changes_workflow: false
7+
estimate_code_review_effort: true
8+
labeling_instructions:
9+
- label: ":scroll: type: API"
10+
instructions: >-
11+
For backward-incompatible changes to the API and deprecations. Mutually exclusive.
12+
- label: ":baby: type: New feature"
13+
instructions: >-
14+
For new features that previously did not exist. Mutually exclusive.
15+
- label: ":wrench: type: Maintenance"
16+
instructions: >-
17+
For internal code changes and cleanups. Mutually exclusive.
18+
- label: ":adhesive_bandage: type: Bug fix"
19+
instructions: >-
20+
For bug fixes. Mutually exclusive.
21+
- label: ":page_facing_up: type: Documentation"
22+
instructions: >-
23+
For changes dedicated to documentation (i.e., not as part of a new feature). Mutually exclusive.
24+
- label: ":robot: type: Infrastructure"
25+
instructions: >-
26+
Fixes to CI and other infrastructure. Mutually exclusive.
27+
- label: ":fast_forward: type: Enhancement"
28+
instructions: >-
29+
Improvements made to an existing feature. Mutually exclusive.
30+
- label: ":chart_with_upwards_trend: type: Performance"
31+
instructions: >-
32+
For changes intended to improve performance. Mutually exclusive.
33+
auto_apply_labels: true
34+
in_progress_fortune: false
35+
poem: false
36+
enable_prompt_for_ai_agents: false
37+
auto_review:
38+
base_branches:
39+
- main
40+
pre_merge_checks:
41+
title:
42+
requirements: >-
43+
Title should be concise and descriptive, ideally under 80 characters, and not end on `.`
44+
45+
chat:
46+
auto_reply: false
47+
48+
knowledge_base:
49+
code_guidelines:
50+
filePatterns:
51+
- CONTRIBUTING.rst
52+
- doc/source/development/core_developer.md

.github/workflows/typing.yml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,44 @@ jobs:
3737
cache: "pip"
3838
cache-dependency-path: "requirements/*.txt"
3939

40-
- name: Install build dependencies
41-
env:
42-
PIP_FLAGS: ${{ matrix.PIP_FLAGS }}
43-
run: |
44-
source .github/scripts/setup-build-env.sh
45-
46-
- name: Build and install from source
47-
run: |
48-
pip install -v --no-build-isolation .
49-
5040
- name: Install docstub
5141
run: |
52-
pip install docstub==0.3.0.post0
42+
pip install docstub~=0.7.0rc0
5343
docstub --version
5444
55-
- name: Create stubs with docstub
45+
- name: Create skimage-stubs with docstub
46+
shell: bash
47+
run: |
48+
echo -e "## docstub output\n\`\`\`" >> $GITHUB_STEP_SUMMARY
49+
(set -o pipefail && \
50+
docstub run --verbose --group-errors --allow-errors=622 \
51+
--workers -1 --out-dir ${MYPYPATH}/skimage src/skimage/ \
52+
2>&1 | tee -a $GITHUB_STEP_SUMMARY)
53+
echo -e "\`\`\`" >> $GITHUB_STEP_SUMMARY
54+
55+
- name: Create skimage2-stubs with docstub
5656
shell: bash
5757
run: |
5858
echo -e "## docstub output\n\`\`\`" >> $GITHUB_STEP_SUMMARY
5959
(set -o pipefail && \
60-
docstub run --verbose --group-errors --allow-errors=626 \
61-
--out-dir ${MYPYPATH}/skimage src/skimage/ \
60+
docstub run --verbose --group-errors \
61+
--out-dir ${MYPYPATH}/skimage2 src/skimage2/ \
6262
2>&1 | tee -a $GITHUB_STEP_SUMMARY)
6363
echo -e "\`\`\`" >> $GITHUB_STEP_SUMMARY
6464
65+
# Not needed yet, since we don't run mypy.stubtest or similar
66+
# which would require importing scikit-image.
67+
#
68+
# - name: Install build dependencies
69+
# env:
70+
# PIP_FLAGS: ${{ matrix.PIP_FLAGS }}
71+
# run: |
72+
# source .github/scripts/setup-build-env.sh
73+
#
74+
# - name: Build and install from source
75+
# run: |
76+
# pip install -v --no-build-isolation .
77+
6578
- uses: actions/upload-artifact@v4
6679
with:
6780
name: skimage-stubs

TODO.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ Version 0.28
1515

1616
Version 0.27
1717
------------
18-
* Remove deprecated `skimage.io.imshow`,
19-
`skimage.io.imshow_collection`, `skimage.io.show`. Remove related plugins.
2018
* Complete deprecation of plugin infrastructure by doing the following:
2119
- Replace calls to `call_plugin` with functions from the imageio plugin
2220
- Remove `skimage/io/_plugins`

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
# developer
2525
- pre-commit
2626
- ipython
27-
- docstub==0.3.0.post0
27+
- docstub==0.7.0rc0
2828
# asv
2929
- asv
3030
# docs

pyproject.toml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ data = ['pooch>=1.6.0']
5959
developer = [
6060
'pre-commit',
6161
'ipython',
62-
'docstub==0.3.0.post0',
62+
'docstub==0.7.0rc0',
6363
'scikit-image[asv]',
6464
]
6565
asv = [
@@ -196,14 +196,15 @@ xfail_strict = true
196196
testpaths = ["tests"]
197197
filterwarnings = [
198198
"error",
199+
"ignore:Importing from the `skimage2` namespace is experimental:UserWarning",
199200
"ignore:.*use `imageio` or other I/O packages directly.*:FutureWarning",
200201
# warn by pyamg in ruge_stuben_solver
201202
"ignore:Implicit conversion of A to CSR:scipy.sparse.SparseEfficiencyWarning",
202203
# Pyodide warning coming via threadpoolctl, remove when
203204
# https://github.com/joblib/threadpoolctl/pull/201 is released
204205
"ignore:.*JsProxy\\.as_object_map.*:RuntimeWarning",
205206
# Warning caused by matplotlib 3.7.0 because it uses deprecated API of pyparsing 3.3.1
206-
"ignore:.*(parseString|resetCache).*:DeprecationWarning:matplotlib",
207+
"ignore:.*(parseString|resetCache|enablePackrat).*:DeprecationWarning:matplotlib",
207208
]
208209
norecursedirs = ["io/_plugins"]
209210

@@ -214,9 +215,24 @@ ignored_user_logins = [
214215
]
215216

216217

218+
[tool.docstub]
219+
ignore_files = [
220+
# deprecated, to be removed before v0.27
221+
"io/_plugins",
222+
"io/manage_plugins.py",
223+
]
224+
217225
[tool.docstub.type_prefixes]
226+
warnings = "warnings"
218227
matplotlib = "matplotlib"
219228
scipy = "scipy"
229+
dask = "dask"
230+
231+
[tool.docstub.type_nicknames]
232+
dtype-like = "np.typing.DTypeLike"
233+
234+
[tool.docstub.types]
235+
Path = "pathlib.Path"
220236

221237
[tool.cibuildwheel]
222238
test-command = "pytest --doctest-plus --pyargs skimage ./tests"

requirements/developer.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# Do not edit this file; modify pyproject.toml instead.
33
pre-commit
44
ipython
5-
docstub==0.3.0.post0
5+
docstub==0.7.0rc0
66
asv; sys_platform != "emscripten"

src/skimage/_shared/_warnings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def expected_warnings(matching):
7777
7878
Parameters
7979
----------
80-
matching : None or a list of strings or compiled regexes
80+
matching : list of str or re.Pattern or None
8181
Regexes for the desired warning to catch
8282
If matching is None, this behaves as a no-op.
8383

src/skimage/_shared/tester.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class PytestTester:
2929
3030
Parameters
3131
----------
32-
module_name : module name
32+
module_name : str
3333
The name of the module to test.
3434
3535
"""
@@ -68,7 +68,7 @@ def __call__(
6868
durations : int, optional
6969
If < 0, do nothing, If 0, report time of all tests, if > 0,
7070
report the time of the slowest `timer` tests. Default is -1.
71-
tests : test or list of tests
71+
tests : Sequence of str
7272
Tests to be executed with pytest '--pyargs'
7373
7474
Returns

src/skimage/_shared/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def assert_stacklevel(warnings, *, offset=-1):
282282
283283
Parameters
284284
----------
285-
warnings : collections.abc.Iterable[warning.WarningMessage]
285+
warnings : Iterable[warnings.WarningMessage]
286286
Warnings that were captured by `pytest.warns`.
287287
offset : int, optional
288288
Offset from the line this function is called to the line were the

src/skimage/_shared/utils.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,23 @@ def __repr__(cls):
205205

206206

207207
class DEPRECATED(metaclass=PatchClassRepr):
208-
"""Signal value to help with deprecating parameters that use None.
208+
"""Signal that a deprecated parameter has not been set.
209209
210-
This is a proxy object, used to signal that a parameter has not been set.
211210
This is useful if ``None`` is already used for a different purpose or just
212211
to highlight a deprecated parameter in the signature.
212+
213+
This is a sentinel and not meant to be initialized.
214+
"""
215+
216+
217+
class DEPRECATED_GOT_VALUE(metaclass=PatchClassRepr):
218+
"""Signal that a value was passed to a deprecated parameter.
219+
220+
Used by :class:`deprecate_parameter` to replace values that were passed to
221+
deprecated parameters. This allows further handling of the deprecated case
222+
inside the decorated function.
223+
224+
This is a sentinel and not meant to be initialized.
213225
"""
214226

215227

@@ -228,9 +240,13 @@ class deprecate_parameter:
228240
template : str, optional
229241
If given, this message template is used instead of the default one.
230242
new_name : str, optional
231-
If given, the default message will recommend the new parameter name and an
232-
error will be raised if the user uses both old and new names for the
233-
same parameter.
243+
The name of a new parameter replacing the deprecated one. If given:
244+
- The default message will recommend the new parameter name.
245+
- Values passed to `deprecated_name` are replaced with
246+
:class:`DEPRECATED_GOT_VALUE`, and the replaced value is passed to
247+
`new_name` instead.
248+
- An error will be raised if the user uses both `deprecated_name` and
249+
`new_name`.
234250
modify_docstring : bool, optional
235251
If the wrapped function has a docstring, add the deprecated parameters
236252
to the "Other Parameters" section.
@@ -267,6 +283,7 @@ class deprecate_parameter:
267283
"""
268284

269285
DEPRECATED = DEPRECATED # Make signal value accessible for convenience
286+
DEPRECATED_GOT_VALUE = DEPRECATED_GOT_VALUE
270287

271288
remove_parameter_template = (
272289
"Parameter `{deprecated_name}` is deprecated since version "
@@ -341,21 +358,20 @@ def fixed_func(*args, **kwargs):
341358
deprecated_value = DEPRECATED
342359
new_value = DEPRECATED
343360

344-
# Extract value of deprecated parameter
361+
# Extract value of deprecated parameter and overwrite with
362+
# DEPRECATED_GOT_VALUE if replacement exists
345363
if len(args) > deprecated_idx:
346364
deprecated_value = args[deprecated_idx]
347-
# Overwrite old with DEPRECATED if replacement exists
348365
if self.new_name is not None:
349366
args = (
350367
args[:deprecated_idx]
351-
+ (DEPRECATED,)
368+
+ (DEPRECATED_GOT_VALUE,)
352369
+ args[deprecated_idx + 1 :]
353370
)
354371
if self.deprecated_name in kwargs.keys():
355372
deprecated_value = kwargs[self.deprecated_name]
356-
# Overwrite old with DEPRECATED if replacement exists
357373
if self.new_name is not None:
358-
kwargs[self.deprecated_name] = DEPRECATED
374+
kwargs[self.deprecated_name] = DEPRECATED_GOT_VALUE
359375

360376
# Extract value of new parameter (if present)
361377
if new_idx is not False and len(args) > new_idx:

0 commit comments

Comments
 (0)