Extensions & Tools
Extensions & Tools
Section titled “Extensions & Tools”JupyterLab Extensions
Section titled “JupyterLab Extensions”Install via pip (modern approach):
# Table of Contentspip install jupyterlab-toc
# Git integrationpip install jupyterlab-git
# Variable inspectorpip install lckr-jupyterlab-variableinspector
# Code formatter (Black/isort)pip install jupyterlab-code-formatter black isort
# Spellcheckerpip install jupyterlab-spellchecker
# Execute Time — shows how long each cell tookpip install jupyterlab-execute-time
# Drawio diagramspip install jupyterlab-drawio
# System monitor (CPU/RAM in status bar)pip install jupyter-resource-usageClassic Notebook Extensions (nbextensions)
Section titled “Classic Notebook Extensions (nbextensions)”pip install jupyter_contrib_nbextensionsjupyter contrib nbextension install --user
# Enable specific extensionsjupyter nbextension enable toc2/mainjupyter nbextension enable collapsible_headings/mainjupyter nbextension enable execute_time/ExecuteTimejupyter nbextension enable varInspector/mainPopular nbextensions:
- Table of Contents (toc2) — sidebar TOC from headings
- Collapsible Headings — fold sections
- ExecuteTime — show execution time per cell
- Variable Inspector — live variable browser
- Autopep8 — auto-format code cells
- Scratchpad — scratch cell that doesn’t affect notebook
JupyterHub
Section titled “JupyterHub”Multi-user Jupyter server for teams:
pip install jupyterhubjupyterhub --generate-configjupyterhubUse cases:
- Team data science environments
- University courses
- Cloud deployments (AWS, GCP, Azure)
Voilà — Notebooks as Dashboards
Section titled “Voilà — Notebooks as Dashboards”Convert notebooks to interactive web apps without showing code:
pip install voilavoila my_notebook.ipynbvoila my_notebook.ipynb --port 8866nbconvert & Automation
Section titled “nbconvert & Automation”# Batch execute all notebooks in a directoryfor nb in notebooks/*.ipynb; do jupyter nbconvert --to notebook --execute "$nb" --output "executed/$nb"done
# Schedule with cron0 6 * * * jupyter nbconvert --to notebook --execute /path/to/report.ipynbUseful Libraries for Notebooks
Section titled “Useful Libraries for Notebooks”# Rich tables and progressfrom rich import printfrom rich.table import Table
# Better DataFramesimport pandas as pdpd.set_option('display.max_columns', None)pd.set_option('display.float_format', '{:.2f}'.format)
# Profiling reportsimport ydata_profiling # formerly pandas-profilingprofile = ydata_profiling.ProfileReport(df)profile.to_notebook_iframe()
# Interactive data explorationimport dtaledtale.show(df)
# Sweetviz — EDA reportsimport sweetviz as svreport = sv.analyze(df)report.show_notebook()Remote Kernels & Cloud
Section titled “Remote Kernels & Cloud”# Connect to a remote kerneljupyter notebook --no-browser --port=8888 --ip=0.0.0.0
# SSH tunnel from local machinessh -N -L 8888:localhost:8888 user@remote-server
# Then open http://localhost:8888 locallyJupyter in VS Code
Section titled “Jupyter in VS Code”VS Code has native Jupyter support:
- Open
.ipynbfiles directly - Run cells with
Shift+Enter - Variable explorer built-in
- Debugger support
- GitHub Copilot integration in cells
nbformat — Programmatic Notebook Creation
Section titled “nbformat — Programmatic Notebook Creation”import nbformatfrom nbformat.v4 import new_notebook, new_code_cell, new_markdown_cell
nb = new_notebook()nb.cells = [ new_markdown_cell("# My Generated Notebook"), new_code_cell("import pandas as pd\ndf = pd.DataFrame({'a': [1,2,3]})"), new_code_cell("df.head()"),]
with open('generated.ipynb', 'w') as f: nbformat.write(nb, f)