You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can we pass command-line arguments to the notebook? Similar to what papermill does? Papermill uses tags n all for that. What i was thinking of using argv to get the arguments within the notebook, just like we do for regular python scripts. I can achieve this using environment variables as well, however arguments way is way more elegant.
The text was updated successfully, but these errors were encountered:
In general nbclient is kept less complicated on this capability and exists as a pure manager of kernel object that can be easily extended to more sophisticated use cases (e.g. papermill and testbook). I'd prefer the logic for parameter parsing stay in those wrapping libraries.
That being said one of the differences to python scripts from kernels is that a kernel captures the launch process entirely and it's not always a 1:1 with a process launch like in pure Python, especially for non-ipykernel situations. This means there's not a general way to pass argv into the process that'll consistently work as you'd expect. Kernel's aren't scripts, they're meant to be more of an application that accepts protocol requests to facilitate a living execution environment. Which means these things don't always translate from Python to Notebooks. This is also the reason papermill injects code cells to pass data to a kernel / notebook session, as it works consistently across programming language and kernel infrastructure.
If you are still looking for a lightweight alternative to papermill, I have written a small tool that provides a click-based CLI for notebooks: https://github.com/ssciwr/nbclick It uses nbclient and nbparameterise under the hood.
How can we pass command-line arguments to the notebook? Similar to what papermill does? Papermill uses tags n all for that. What i was thinking of using argv to get the arguments within the notebook, just like we do for regular python scripts. I can achieve this using environment variables as well, however arguments way is way more elegant.
The text was updated successfully, but these errors were encountered: