VS Code sync & extension guide
Edit Fabric notebooks, environments, and pipelines from VS Code — with Git, real linting, and no browser tab.
Why leave the web UI
- Real editor: multi-cursor, extensions,
ruff/black, GitHub Copilot. - Local Git: branch, diff, rebase without the workspace source-control panel.
- Run and debug notebooks against a remote Fabric Spark session or locally.
Options
The Fabric Data Engineering VS Code extension (Microsoft, from the Marketplace) is the primary path.
- Install the extension + the Jupyter and Python extensions.
Ctrl/Cmd-Shift-P → Fabric: Sign In.Fabric: Set Workspace→ pick your dev workspace.- Notebooks appear under the Fabric explorer. Open one — it edits the
.pyrepresentation locally. - Pick a kernel: Fabric Runtime (remote Spark) for real capacity, or a local Python env for pure-Python cells.
Recommended local layout
Ingest.Notebook.py
Transform.Notebook.py
pyproject.toml
README.md
// .vscode/settings.json
{
"notebook.formatOnSave.enabled": true,
"[python]": { "editor.defaultFormatter": "charliermarsh.ruff" },
"python.testing.pytestEnabled": true
}Local unit tests for notebook logic
Extract pure functions out of notebooks into a src/ package and test them with
plain pytest + a local pyspark:
# src/transforms.py
from pyspark.sql import DataFrame, functions as F
def add_audit_cols(df: DataFrame, run_date: str) -> DataFrame:
return df.withColumn("run_date", F.lit(run_date)) \
.withColumn("_ingested_at", F.current_timestamp())# tests/test_transforms.py
def test_add_audit_cols(spark):
out = add_audit_cols(spark.createDataFrame([(1,)], ["id"]), "2026-01-01")
assert "run_date" in out.columns
assert out.first()["run_date"] == "2026-01-01"The notebook then just imports and calls — thin glue, thick tested library.
Keep the notebook's parameter cell as the only stage-specific surface. Everything below it should be importable, testable Python.
Gotchas
mssparkutils/notebookutilsonly exist in a Fabric session. Guard imports so local test collection doesn't blow up.- Remote kernel start is slow (pool spin-up). Keep a session warm while iterating.
- The extension writes the
.platformmetadata file — commit it; don't edit it.
Stay ahead of Fabric changes
Fabric runtime changes, API updates, and deprecations. No spam, unsubscribe anytime.