Skip to content

[FEATURE]: Implement CLI output rerouting #3877

@bcdurak

Description

@bcdurak

Contact Details [Optional]

No response

Feature Description

Add global stdout-to-stderr rerouting for all ZenML CLI commands to enable clean output piping. Currently, logs, debug messages, and progress indicators are mixed with actual command output on stdout, making it difficult to pipe results to files or other commands without including unwanted log noise.

Problem or Use Case

Enable clean command chaining like zenml pipeline list --format json > pipelines.json or zenml stack export | jq '.components' where only the intended data output goes to the file/pipe, while all logs and status messages remain visible on the terminal via stderr.

Proposed Solution

Modify the existing ZenMLCLI class to automatically reroute stdout to stderr during command execution, while providing a clean_output() utility function for commands that need to send specific data to stdout for piping. This would be implemented by overriding the invoke() method to globally apply the rerouting without requiring changes to individual commands.

Alternatives Considered

No response

Additional Context

No response

Priority

None

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestplannedPlanned for the short term

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions