mpastell / Pweave

Pweave is a scientific report generator and a literate programming tool for Python. It can capture the results and plots from data analysis and works well with numpy, scipy and matplotlib.
http://mpastell.com/pweave
Other
435 stars 64 forks source link

Option to exit with non-zero status when exception raised #100

Open jncraton opened 6 years ago

jncraton commented 6 years ago

Is it possible to force Pweave to exit with a non-zero exit status when it encounters an exception is raised from a code block?

Often when I'm working on something I'm embedding tests and sanity checks in my code blocks to make sure that things are working properly. It would speed up my coding cycle if I could get immediate feedback that these have failed rather than having to look through the output file.

Is this possible? If not, is this a feature that others might want that I could add as a CLI flag?

abukaj commented 6 years ago

I think by default pweave shall not report exception as raising an exception may be intended behaviour of the code block (e.g. in a tutorial paper).

However I think either CLI flag or chunk option (or both) changing the default behaviour will be useful indeed.

jncraton commented 6 years ago

I agree completely. Sorry I didn't make that clear originally. The default behavior should remain unchanged, but a chunk option and/or CLI flag to adjust this behavior would be nice.

mpastell commented 6 years ago

It is not currently possible. A pull request that implements this options would be nice.