papermill icon indicating copy to clipboard operation
papermill copied to clipboard

Render parameter code cells with linting rules

Open MSeal opened this issue 5 years ago • 2 comments

Large parameters print on a single line, which can be nasty to read. We should format the outputs so they're presented as someone would write the code in reality. Let's figure out how to pretty print the language contents, at least for python if not for all languages.

papermill Untitled.ipynb Untitled-out.ipynb -y '{"nested": [1,2,3,4,5,6,7,8,1.2,4,1,5,6,1,2,3,5,6,12,[6,5,5,2,232,121,4,5,6,1,1,1,5,5],16,231,32,5,6,1,1]}'

bad

MSeal avatar May 06 '19 14:05 MSeal

One solution for python might be to use autopep8 as a module. https://github.com/hhatto/autopep8/blob/master/README.rst#use-as-a-module

Now this is very specific to python. Idk how it work for other kernels, subprocess call maybe? Assuming the programs even allow string input from stdin

AndersonReyes avatar Dec 28 '19 03:12 AndersonReyes

For python3 we're now using black to format for python dependencies via #455 in the next release. For other languages we don't have a standard solution as of yet. A kernel protocol addition could solve it but that might be hard to make standard.

MSeal avatar Dec 29 '19 22:12 MSeal