Context
PR #30 moved pipeline functions from scripts/build_v5_snapshot.py into leadforge/pipelines/build_v5.py. These functions (subsample() in particular) print warnings directly to sys.stderr.
Now that they live in the package, downstream callers can't easily suppress or redirect this output. Library code should use warnings.warn() or a logger instead.
What to do
- Replace
print(..., file=sys.stderr) calls in leadforge/pipelines/build_v5.py with warnings.warn(..., stacklevel=2)
- Update tests in
tests/scripts/test_build_v5_snapshot.py to use pytest.warns() instead of capsys.readouterr()
- Optionally keep the
print in the CLI wrapper (scripts/build_v5_snapshot.py) for user-facing progress messages
Origin
Copilot review comment on PR #30.
Context
PR #30 moved pipeline functions from
scripts/build_v5_snapshot.pyintoleadforge/pipelines/build_v5.py. These functions (subsample()in particular) print warnings directly tosys.stderr.Now that they live in the package, downstream callers can't easily suppress or redirect this output. Library code should use
warnings.warn()or a logger instead.What to do
print(..., file=sys.stderr)calls inleadforge/pipelines/build_v5.pywithwarnings.warn(..., stacklevel=2)tests/scripts/test_build_v5_snapshot.pyto usepytest.warns()instead ofcapsys.readouterr()printin the CLI wrapper (scripts/build_v5_snapshot.py) for user-facing progress messagesOrigin
Copilot review comment on PR #30.