Skip to content

Conversation

@radekosmulski
Copy link
Contributor

This PR adds a --verbose flag to the exec_nb command-line tool to display stdout/stderr output in real-time during
notebook execution.

Motivation:
When running long-running notebooks from the command line, it's helpful to see progress and output as it happens, rather
than waiting until the entire notebook completes.

Changes:

  • Added verbose parameter throughout the execution chain (CLI → execute → run_all → cell → run → run_cell → _run)
  • Modified CaptureShell._run to conditionally capture stdout/stderr based on the verbose flag
  • Updated help text and documentation

Usage:
exec_nb notebook.ipynb --verbose

Testing:
The feature has been tested with notebooks containing print statements, stderr output, and progress indicators. Output
correctly streams to the terminal when verbose is enabled while still being captured in the notebook when saved.

@gitnotebooks
Copy link

gitnotebooks bot commented Jun 7, 2025

Found 2 changed notebooks. Review the changes at https://app.gitnotebooks.com/AnswerDotAI/execnb/pull/75

@jph00
Copy link
Contributor

jph00 commented Jul 4, 2025

Hey @radekosmulski this looks great! Please at-mention me or add me as a reviewer so I don't miss your PRs 🗡️

Currently the two notebooks are not well formed, according to github when I try to view them. Can you please open them in jupyter and re-save them after executing them to ensure they are valid?

@radekosmulski radekosmulski force-pushed the add-verbose-option branch 4 times, most recently from 70c3354 to 604b9f8 Compare July 4, 2025 03:53
@radekosmulski
Copy link
Contributor Author

Absolutely, will tag you going forward, @jph00! 🙂 Thank you so much for looking at this! 🙏

I believe I fixed some issues, but not sure. Also, some cells seem to have different output which is coming up on the diff without a really good reason -- but not sure how I can fix it nor do we care about this sort of stuff:
image

If anything else would need to be done on this, please let me know! 🙏

@jph00
Copy link
Contributor

jph00 commented Jul 4, 2025

lgtm! :)

- Added verbose parameter throughout the execution chain
- Modified CaptureShell._run to conditionally capture stdout/stderr
- When --verbose is used, output streams to terminal in real-time
- Updated documentation in README.md and help text
@radekosmulski
Copy link
Contributor Author

sorry @jph00 I keep screwing this up 🙂 but should be okay now, didn't make any changes after export

@jph00 jph00 merged commit 0bd8422 into AnswerDotAI:main Jul 4, 2025
1 check passed
@jph00
Copy link
Contributor

jph00 commented Jul 4, 2025

All sorted @radekosmulski , no problem! :D

@jph00 jph00 added the enhancement New feature or request label Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants