- Added
Get-DIBBlockand `ConvertFrom-DIB' converts a dib to an ipynb - Updated
Add-NotebookCodeto check$DotNetInteractiveand gen the correct metadata - Added
ConvertTo-Dib. Converts anipynbfile to adibfile.
- Add
-DotNetInteractiveinConvertTo-PowerShellNoteBook - Add
vscodelanguageIddotnet-interactive.pwshtoNew-PSNotebook
- Added
New-InteractiveNotebook- Create a new interactive notebook as adiboripynb, launching vscodeOpen-InteractiveNotebook- Open a local notebook or from remote source
- Merged DF's code with my additions from late 2020 - see below ...
- Added Horizontal rules either side of output in
ConvertFrom-ipynb - Added
-AddLanguageLabelstoConvertFrom-ipynbfor polyglot notebooks in .net interactive - Added improved html rendering for PowerShell and HTML code cells in
ConvertFrom-ipynb - Changed encoding in
New-PSNotebookto UTFNoBOM, Byte order mark breaks in VS Code. Must check this is OK elsewhere
- Added
Cellnumber to ouput ofGet-NotebookContent
Cell NoteBookName Type IsParameterCell Language Source
---- ------------ ---- --------------- -------- ------
1 UsedForCellNumbers.ipynb markdown False C# (.NET Interactive) ---…
2 UsedForCellNumbers.ipynb code False PowerShell (.NET Interactive) 'hello world'
3 UsedForCellNumbers.ipynb markdown False C# (.NET Interactive) ---…
4 UsedForCellNumbers.ipynb code False PowerShell (.NET Interactive) 'hello world, again'
Invoke-ExecuteNotebookexecutes a notebook, headless. Using the-DotNetInteractiveswitch, add the correct metadata so the notebook works in VS Code with the .NET Notebook extension
Invoke-ExecuteNotebook -InputNotebook .\PSInteractive.ipynb -OutputNotebook .\PSInteractiveOut.ipynb -Parameters @{max=15} -DotNetInteractive- Added support for .NET interactive notebooks, PowerShell, C#, F#, and SQL
- Added
IsParameterCellproperty toGet-NotebookContent. Shows what cell, if any, is a parameter cell
- Fixed a bug in ConvertTo-PowerShellNotebook (missing -raw)
- Fixed a bug in ConvertToPowerShellNotebookTests (test-pat with no H)
- Fixed a couple of other test issues, including skipping SQL tests if SQL server module is not present.
- Revamped New-GistNotebook - Accepts piped input. Takes -Public switch. Looks up Personal Access Token if Git is setup locally and has saved the PAT for Github in Windows Cred Manager.
- Added Set-NotebookToPS to convert a notebook from format used by the .Net Interactive add for VS code (C# notebook with #!Pwsh magic commands to turn cells into PowerShell ones. )
- Added Language and presence of parameterized cells to Get-Notebook results.
- Created a new ConvertFrom-IPYNB which incorporates the convertFrom-NotebookToMarkdown, and export-notebookToPowerShell script functionality and adds convert to html as well.
- In several places I've changed the name of "path to notebook" parameters to be
path(with the old name and "fullname" as aliases) and added ValueFromPipelineByProperty name so items can be pipe items in, and also ensured path can be a list and contain wildcards. - Added -Recurse to Get-Notebook.
- Export NotebookToPowerShellScript
- Parameter change BREAKING Made IncludeTextCells a switch; added switch AsText, renamed Outpath to a more conventional Destination (keeping alias of outpath)
- Removed different path split for URLs
- Got date to output in local culture , and made the aligned header. (also did this for Export-NotebooktoSqlcript.)
- Assume any type other than code will go in a comment block (i.e. if it isn't markdown, still put it in a comment if it isn't code), and insert a dummy comment between code adjacent codeblocks to prevent them merging
- Return the file object created if there is one.
- Added support for piping files in.
- Fixed all the places I broke the test!
- Get-NotebookContent
- parameter changes: gave
JustCodean alias ofNoMarkdownandJustMarkdownan alias ofNoCodemade them mutually exclusive. Added switchIncludeOutput IncludeOutputtries to return either the stream output from Jupyter or the data::Text/plain output from the vs code extension sensibly, and will also return data::Text/html output / make reasonable sense of mixed outputs. -Also made sure that wildcards and piped input files are supported
- parameter changes: gave
- ConvertFrom-NotebookToMarkdown
- parameter changes: gave
NoteBookNamean alias ofPath, addedDestination- defaulting to current dir, and switchIncludeOutput IncludeOutputis passed toGet-NotebookContent. IfGet-NotebookContentreturns output and it is a string we'll output it as preformatted block of markdown. If it is a single block of HTML we'll output that to into the MD.- If
destinationis a directory, use the source filename converted from .ipynb to .md, otherwise treat destination as a file name. At the end, output the file object, not the name
- parameter changes: gave
- DSL/Add-NotebookCode
- Gave function an experimental alias of
codecell - parameter chanages:
-codeis now mandatory, also support non text-stream output through-Displaydata, allow the GUID for Azure data studio to be disabled with-NoGUID. - Add support for magic commands -
aboutandtime, removepwshif present. - Ensure code isn't run if
DisplayDatais provided. - Change process for building the cell to allow
DisplayDatato work, and also to make theazdata_cell_guidoptional
- Gave function an experimental alias of
- DSL/Add-NotebookMarkdown
- Gave function an experimental alias of
mdcell
- Gave function an experimental alias of
- DSL New-PSNotebook
- Gave function an experimental alias of
PSNotebook. The aliases allow writingpsnotebook {codecell $foo; mdcell $bar} file.ipynb - parameter chanages: added
Runspaceand switchesDotNetInteractive(alias DNI) andSQLto select templates SQL IS UNTESTED - if
Runspaceis passed, add members needed to allow.Invoke()to work as it does for a created runspace. - Moved the template for the Azure-data-studio/Windows-PowerShell notebook to the top of the file, and created a template for a .net interactive notebook. Selection is made by presence of the
-DotNetInteractiveswitch. - Made
asTextredundant - no output name = "as text" , and add.ipynbto file name if it is not present.
- Gave function an experimental alias of
- 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.


