echo=False by default in pweave

465 Views Asked by At

How can I set the flag echo=False by default to all code, when precessing a python-script file with pweave.

Minimal example:

#' # Minimal example.

#' This is a minimal example, which
#' says 'hello' to you.

#+ echo=False
print('Hello')

#' The end.

Which gets processed by

# either: py to html
pypublish test.py

# or: py to markdown
pweave -f pandoc test.py
1

There are 1 best solutions below

0
On BEST ANSWER

Include the following lines at the very beginning of your document: 1.set the echo false for the first code chunk and then change it to false for every other code chunk. 2.You can have a look in the documentation http://mpastell.com/pweave/defaults.html

#+ echo = False
import pweave
pweave.rcParams["chunk"]["defaultoptions"].update({'echo' : False,
'f_pos' : "h!"})

Following the documentation you can also change other parameters, I have picked 'f_pos' from documentation.