vpype_cli¶
This module implements vpype’s CLI interface and the execute()
function.
Functions
Execute a vpype pipeline. |
Functions¶
-
execute
(pipeline, document=None)¶ Execute a vpype pipeline.
This function serves as a Python API to vpype’s pipeline. It can be used from a regular Python script (as opposed to the
vpype
CLI which must be used from a console or viaos.system()
.If a
vpype.Document
instance is provided, it will be preloaded in the pipeline before the first command executes. The pipeline’s content after the last command is returned as avpype.Document
instance.Examples
Read a SVG file, optimize it and return the result as a
vpype.Document
instance:>>> doc = execute("read input.svg linemerge linesimplify linesort")
Optimize and save a
vpype.Document
instance:>>> doc = vp.Document() >>> # populate `doc` with some graphics >>> execute("linemerge linesimplify linesort write output.svg", doc)