Created
January 26, 2024 01:49
-
-
Save ronaldokun/ecc50749fce9b9b97012e4d5036a3c63 to your computer and use it in GitHub Desktop.
Execute notebook in a terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import nbformat,fire | |
| from nbconvert.preprocessors import ExecutePreprocessor | |
| def run_notebook(path): | |
| nb = nbformat.read(open(path), as_version=nbformat.NO_CONVERT) | |
| ExecutePreprocessor(timeout=600).preprocess(nb, {}) | |
| print('done') | |
| if __name__ == '__main__': fire.Fire(run_notebook) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment