Skip to content

Commit c21d3ab

Browse files
ieivanovclaude
andcommitted
refactor!: drop num_processes and num_threads kwargs
Both were deprecated in the previous commit ('refactor: add num_workers/use_threads to process_single_position'), with shims that forwarded their values to num_workers. Drop the shims now — anything still passing num_processes / num_threads gets a TypeError pointing at the right argument name, which is more useful than a silent DeprecationWarning that callers may never see (Python suppresses DeprecationWarning raised from package code under the default filter). Removes the corresponding regression test (test_process_single_position_legacy_kwargs_deprecated) and the unused 'warnings' import. BREAKING CHANGE: callers of process_single_position must use num_workers (and, optionally, use_threads) instead of num_processes / num_threads. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent af9b925 commit c21d3ab

2 files changed

Lines changed: 0 additions & 50 deletions

File tree

src/iohub/ngff/utils.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import itertools
55
import multiprocessing as mp
66
import os
7-
import warnings
87
from collections import defaultdict
98
from collections.abc import Callable, Sequence
109
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, as_completed
@@ -305,8 +304,6 @@ def process_single_position(
305304
output_time_indices: list[int] | None = None,
306305
num_workers: int = 1,
307306
use_threads: bool = False,
308-
num_processes: int | None = None,
309-
num_threads: int | None = None,
310307
**kwargs,
311308
) -> None:
312309
"""
@@ -354,34 +351,13 @@ def process_single_position(
354351
If True, parallelize across threads via ``ThreadPoolExecutor``;
355352
otherwise spawn worker processes via ``ProcessPoolExecutor``.
356353
Defaults to False.
357-
num_processes : int, optional
358-
Deprecated. Use ``num_workers`` instead. When set, its value is
359-
forwarded to ``num_workers``.
360-
num_threads : int, optional
361-
Deprecated. Use ``num_workers`` (and ``use_threads=True``) instead.
362-
When set, its value is forwarded to ``num_workers``.
363354
kwargs : dict, optional
364355
Additional arguments to pass to the function.
365356
A dictionary with key "extra_metadata"
366357
can be passed to be stored at a FOV level,
367358
e.g.,
368359
kwargs={"extra_metadata": {"Temperature": 37.5, "CO2_level": 0.5}}.
369360
"""
370-
if num_processes is not None:
371-
warnings.warn(
372-
"num_processes is deprecated; use num_workers instead.",
373-
DeprecationWarning,
374-
stacklevel=2,
375-
)
376-
num_workers = num_processes
377-
if num_threads is not None:
378-
warnings.warn(
379-
"num_threads is deprecated; use num_workers "
380-
"(with use_threads=True for a thread pool) instead.",
381-
DeprecationWarning,
382-
stacklevel=2,
383-
)
384-
num_workers = num_threads
385361
click.echo(f"Function to be applied: \t{func}")
386362
click.echo(f"Input data path:\t{input_position_path}")
387363
click.echo(f"Output data path:\t{output_position_path}")

tests/ngff/test_ngff_utils.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -825,32 +825,6 @@ def test_available_cpus_honours_slurm_env(monkeypatch, env, expected_min, expect
825825
assert n == expected_max
826826

827827

828-
@pytest.mark.parametrize("legacy_kwarg", ["num_processes", "num_threads"])
829-
def test_process_single_position_legacy_kwargs_deprecated(tmp_path, legacy_kwarg):
830-
"""`num_processes` and `num_threads` emit DeprecationWarning and forward to `num_workers`."""
831-
shape = (1, 1, 2, 4, 4)
832-
position_key = ("A", "1", "0")
833-
input_store = tmp_path / "input.zarr"
834-
output_store = tmp_path / "output.zarr"
835-
for store in (input_store, output_store):
836-
create_empty_plate(
837-
store_path=store,
838-
position_keys=[position_key],
839-
channel_names=["c0"],
840-
shape=shape,
841-
)
842-
populate_store(input_store, [position_key], shape, np.float32)
843-
844-
with pytest.warns(DeprecationWarning, match=f"{legacy_kwarg} is deprecated"):
845-
process_single_position(
846-
func=dummy_transform,
847-
input_position_path=input_store / Path(*position_key),
848-
output_position_path=output_store / Path(*position_key),
849-
constant=1,
850-
**{legacy_kwarg: 2},
851-
)
852-
853-
854828
# -- Explicit tests for version-specific chunk/shard defaults -----------------
855829
#
856830
# The hypothesis-based test_create_empty_plate exercises many parameter

0 commit comments

Comments
 (0)