context parsers permalink

pypyr has a whole bunch of ready-made built-in context parsers to make your life easier. A context parser allows you to customize how you want to pass cli arguments to your pipeline.

Making your own custom context-parser is super easy too.

# everything after mypipeline goes to the context_parser
$ pypyr mypipeline these are all context input arguments
$ pypyr mypipeline key1=value2 key2="value 2"

A context_parser parses the pypyr command’s context input arguments. This is all the positional arguments after the pipeline-name from the command line.

The chances are pretty good that the context_parser will take the context command arguments and put in into the pypyr context.

The pypyr context is a dictionary that is in scope for the duration of the entire pipeline. The context_parser can initialize the context. Any step in the pipeline can add, edit or remove items from the context dictionary.

built-in context parsers permalink

titleexample cli input
dictpypyr pipelinename param1=value1 param2="value 2" param3=value3
jsonpypyr pipelinename {"key1": "value 1", "key2": 123}
jsonfilepypyr pipelinename ./path/sample.json
keyspypyr pipelinename param1 'par am2' param3
keyvaluepairspypyr pipelinename param1=value1 param2="value 2" "param 3"=value3
listpypyr pipelinename param1 param2 param3
stringpypyr pipelinename arbitrary string here
yamlfilepypyr pipelinename ./path/sample.yaml
last updated on .