pypyr.steps.echo permalink

write dynamic values to console output stdout permalink

Echo (i.e print) the context value echoMe to the output.

For example, if you had a pipeline like this:

# ./mypipeline.yaml
context_parser: pypyr.parser.keyvaluepairs
steps:
  - name: pypyr.steps.echo

You can run:

$ pypyr mypipeline "echoMe=Ceci n'est pas une pipe"

Alternatively, if you had a pipeline like this:

# ./look-ma-no-params.yaml
steps:
  - name: pypyr.steps.echo
    comment: Output echoMe
    in:
      echoMe: Ceci n'est pas une pipe

You can run:

$ pypyr look-ma-no-params

Supports string substitutions.

write complex objects to output permalink

echo will serialize complex objects like dict or list to stdout for you.

# ./echo-list.yaml
steps:
  - name: pypyr.steps.set
    in:
      set:
        obj:
          - item1
          - item2
          - item3
  - name: pypyr.steps.echo
    in:
      echoMe: "This is a list: {obj}"

When you run this pipeline, the list will serialize to human-readable form:

$ pypyr echo-list
This is a list: ['item1', 'item2', 'item3']

If you want to dump context to output for troubleshooting purposes, debug is useful for pretty printing with more human readable indented formatting.

suppress echo output permalink

echo prints to the NOTIFY (25) log-level. This means you won’t see echo output if you set log-level higher than 25.

For example, pypyr mypype --log 30 will only show WARNING and ERROR log messages, not any echo output.

see also

last updated on .