Use @captureOutput decorator to integrate the output of third-party Python libraries
Suppose that you want to reuse your PixieApp in a third-party library that you have been using for a while in order to perform a certain task, such as, for example, computing clusters with the scikit-learn machine learning library (http://scikit-learn.org) and displaying them as a graph. The problem is that most of the time, you are calling a high-level method that doesn't return data, but rather directly draws something on the cell output area, such as a chart or a report table. Calling this method from a PixieApp route will not work because the contract for routes is to return an HTML fragment string that will be processed by the framework. In this case, the method most likely doesn't return anything since it is writing the results directly in the cell output. The solution is to use the @captureOutput
decorator—which is part of the PixieApp framework—in the route method.