- Refactored new functions to separate files
- Added short animation on parameterized a notebook using Azure Data Studio
- Added
Test-HasParameterizedCell - Added alias
xnbforInvoke-ExecuteNotebook Invoke-ExecuteNotebooknow hasWrite-Progress, percent done is based on each cell executed- Added -ReturnAdObjects to
Invoke-ExecuteNotebook. By defaultInvoke-ExecuteNotebookreturns a string.
Invoke-ExecuteNotebook -InputNotebook .\basic.ipynb -ReturnAdObjects- Added
Export-AsPowerShellNotebooksuper useful for things like converting your PowerShell history into an interactive notebook.
You need to Install-Module -Name Microsoft.PowerShell.ConsoleGuiTools
Get-History | % command* | Out-ConsoleGridView | Export-AsPowerShellNotebook -OutputNotebook .\temp\testthis.ipynb- Added better handling of parameters to be injected into the notebook.
- This will inject the variable
$arr = 1, 2, 3as the first cell in the notebook .\basic.ipynb and then execute all the cells in the notebook and output them tostdout.
$params = @{
arr = 1, 2, 3
}
Invoke-ExecuteNotebook -InputNotebook .\basic.ipynb -Parameters $params- Added features to
ConvertTo-PowerShellNotebook- Pipe files to the function
- Handles URLs with PowerShell files as endpoints
- Handles any mix of Files and URLs for conversion
-
Added
-PassThrutoGet-NotebookContentto get back all cell types beyond markdown and- This enables extracting output types like display_data for things like JavaScript which can be saved to an
.htmlfile and then displayed in browser
- This enables extracting output types like display_data for things like JavaScript which can be saved to an
-
Added
Get-NotebookDisplayData. Gets only cells withdisplay_dataforoutput_type. Helper function using the above functionGet-NotebookContent.
ConvertTo-PowerShellNoteBooknow supports reading a.ps1from a URL
- Invoke-ExecuteNotebook supports
-Forceto overwrite-OutputNotebookif it exists locally
- Invoke-ExecuteNotebook supports the following for output paths:
- Local file system:
c:\temp\test.ipynb - GitHub gist:
gist:// - Azure Blob Store:
abs://
- Local file system:
-
Added Invoke-ExecuteNotebook lets you:
- parameterize notebooks
- execute notebooks
This opens up new opportunities for how notebooks can be used. For example:
-
Perhaps you have a financial report that you wish to run with different values on the first or last day of a month or at the beginning or end of the year, using parameters makes this task easier.
-
Do you want to run a notebook and depending on its results, choose a particular notebook to run next? You can now programmatically execute a workflow without having to copy and paste from notebook to notebook manually.
-
Lets you save the execution to a new notebook using
-OutputNoteBook -
Lets you save the execution to a to a
GitHub gist-OutputNoteBook gist://test.ipynb- Requires you to set
$env:GITHUB_TOKENto a GitHub PAT
- Requires you to set
-
Invoke-ExecuteNotebook supports reading a notebook from a URL
Invoke-ExecuteNotebook https://raw.githubusercontent.com/dfinke/PowerShellNotebook/master/__tests__/NotebooksForUseWithInvokeOutfile/parameters.ipynb - Plus, after reading it from a url you can save out to a
gist
Invoke-ExecuteNotebook https://raw.githubusercontent.com/dfinke/PowerShellNotebook/master/__tests__/NotebooksForUseWithInvokeOutfile/parameters.ipynb -OutputNotebook gist://testout.ipynbThe parameters cell is assumed to specify default values which may be overridden by values specified at execution time.
Invoke-ExecuteNotebookinserts a new cell taggedinjected-parametersafter the parameters cellinjected-parameterscontains only the overridden parameters subsequent cells are treated as normal cells, even if also tagged parameters- If no cell is tagged parameters, the
injected-parameterscell is inserted at the top of the notebook
- Added
-OutfiletoInvoke-PowerShellNotebook. It creates a new notebook, copies the old one, and executes eachcode cell, updating the new notebook with the results.