Skip to content

Enable multiple pipe_input targets#1656

Draft
Probablism wants to merge 1 commit into
apache:mainfrom
Probablism:fix-pipe-input-multiple-targets
Draft

Enable multiple pipe_input targets#1656
Probablism wants to merge 1 commit into
apache:mainfrom
Probablism:fix-pipe-input-multiple-targets

Conversation

@Probablism

Copy link
Copy Markdown
Contributor

Fixes #1177

This enables multiple-target pipe_input behavior and restores the corresponding targeting API and tests.

Changes

  • Allow pipe_input(..., on_input=[...]) to target more than one function parameter.
  • Restore step(...).on_input(...) for per-step input targeting.
  • Support mixed global/local targeting, where local targets add to the global target list.
  • Reject ambiguous or invalid targets instead of falling back to the first parameter.
  • Update the pipe_input docstring and restore the matching unit/resource tests.

How I tested this

  • UV_CACHE_DIR=/tmp/hamilton-uv-cache .uv-tools/bin/uv run pytest tests/function_modifiers/test_macros.py -q -k pipe_input
  • UV_CACHE_DIR=/tmp/hamilton-uv-cache .uv-tools/bin/uv run pytest tests/function_modifiers/test_macros.py -q
  • UV_CACHE_DIR=/tmp/hamilton-uv-cache .uv-tools/bin/uv run pytest tests/function_modifiers tests/test_function_modifiers.py -q
  • UV_CACHE_DIR=/tmp/hamilton-uv-cache .uv-tools/bin/uv run pytest tests/ --cov=hamilton --ignore tests/integrations -q
  • UV_CACHE_DIR=/tmp/hamilton-uv-cache .uv-tools/bin/uv run ruff check hamilton/function_modifiers/macros.py tests/function_modifiers/test_macros.py tests/resources/pipe_input.py
  • UV_CACHE_DIR=/tmp/hamilton-uv-cache .uv-tools/bin/uv run ruff format --check hamilton/function_modifiers/macros.py tests/function_modifiers/test_macros.py tests/resources/pipe_input.py
  • git diff --check

Notes

This keeps the old default behavior for on_input=None and the existing single-target behavior for on_input="param". I did not change pipe_output or mutate.

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the focused checks listed above & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@skrawcz skrawcz requested a review from jernejfrank July 3, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

multiple target parameters for pipe_input

1 participant