context parsers permalink

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

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
argskwargspypyr my-pipeline arg1 arg2 k1=value1 k2="value 2"
dictpypyr my-pipeline param1=value1 param2="value 2" param3=value3
jsonpypyr my-pipeline {"key1": "value 1", "key2": 123}
jsonfilepypyr my-pipeline ./path/sample.json
keyspypyr my-pipeline param1 'par am2' param3
keyvaluepairspypyr my-pipeline param1=value1 param2="value 2" "param 3"=value3
listpypyr my-pipeline param1 param2 param3
stringpypyr my-pipeline arbitrary string here
tomlfilepypyr my-pipeline ./path/sample.toml
yamlfilepypyr my-pipeline ./path/sample.yaml
last updated on .