Skip to main content

pyfabric

CI PyPI version Python License: MIT

Python library for creating, validating, and locally testing Microsoft Fabric items that are compatible with Fabric git sync.

Use Fabric MCP for ad-hoc agent operations and fab for interactive terminal work. Use pyfabric to build and validate git-sync artifacts, test locally, or publish in dependency order from Python to workspaces without Git integration. For a Git-connected workspace, build and validate the artifacts, commit and push them, and have the workspace owner manually sync in Fabric. See Microsoft Fabric tooling and pyfabric for the tool matrix.

Installation

pip install pyfabric

Optional dependencies

pip install pyfabric[azure]         # Azure authentication and REST client
pip install pyfabric[data]          # OneLake and SQL data access
pip install pyfabric[lakehouse-io]  # Delta table writes (deltalake + pyarrow)
pip install pyfabric[testing]       # DuckDB Spark mock and pytest fixtures
pip install pyfabric[dataagent]     # Data agent MCP query client
pip install pyfabric[deploy]        # parameter.yml substitution (PyYAML)
pip install pyfabric[all]           # All optional dependencies

AI assistant context (optional)

pyfabric ships with reference memories so any AI coding assistant can learn the library without you re-explaining it every session. Two ways to install, depending on your assistant:

Claude Code — one command, installs into your active Claude profile:

pyfabric install-claude-memory            # active profile projects/<home-slug>/memory
pyfabric install-claude-memory --dry-run  # show what would change
pyfabric install-claude-memory --force    # overwrite installed topic files

On upgrade, the installer appends missing MEMORY.md entries by linked filename, including the entry for mcp_vs_pyfabric.md if it is new to your profile. It keeps existing index summaries even when --force refreshes the topic files.

If your installed DataAgent index entry says that .platform uses CRLF, compare it with the current source catalog and update that summary in your profile's MEMORY.md. DataAgent .platform uses LF, config JSON uses CRLF, and both omit the trailing newline. Keep your custom notes and other index entries.

Any other assistant — emit the memories as portable markdown and redirect to whatever file your tool reads:

pyfabric emit-context > .github/copilot-instructions.md   # GitHub Copilot
pyfabric emit-context > .cursorrules                      # Cursor
pyfabric emit-context > .continuerules                    # Continue
pyfabric emit-context > CONVENTIONS.md                    # Aider

emit-context strips Claude-specific frontmatter and skips the index file, so the output is plain markdown any LLM can consume. Commit the generated file so teammates' assistants pick it up too, and re-run after upgrading pyfabric.

Quick start

First-run smoke test

After pip install "pyfabric[azure]", verify install + auth + the core read APIs in one command:

pyfabric demo "<your_workspace_display_name>"
pyfabric demo "<your_workspace_display_name>" --show-definitions

It lists accessible workspaces, resolves the one you named (with case-insensitive and "did you mean" fallbacks), and summarises its items. Read-only — no writes, no pushes. Equivalent script form: examples/workspace_demo.py.

Validate a Fabric workspace

from pathlib import Path
from pyfabric.items.validate import validate_workspace

results = validate_workspace(Path("my_workspace/"))
for r in results:
    status = "OK" if r.valid else "FAIL"
    print(f"{status}: {r.item_path.name}")
    for e in r.errors:
        print(f"  ERROR: {e.message}")

List workspaces with the REST client

# docs-snippet: network
from pyfabric.client.auth import FabricCredential
from pyfabric.client.http import FabricClient
from pyfabric.workspace.workspaces import list_workspaces

cred = FabricCredential(tenant="contoso")
client = FabricClient(cred)

for ws in list_workspaces(client):
    print(f"{ws['displayName']}  {ws['id']}")

Test notebook logic locally

# In your test file (pytest)
def test_my_notebook(fabric_spark, mock_notebookutils):
    # fabric_spark is a DuckDB-backed SparkSession replacement
    df = fabric_spark.sql("SELECT 1 AS value, 'hello' AS msg")
    rows = df.collect()
    assert rows[0]["value"] == 1

    # mock_notebookutils replaces Fabric notebookutils
    mock_notebookutils.fs.mkdirs("/output")
    mock_notebookutils.fs.put("/output/result.txt", "done")

Documentation

Document Description
Tooling ecosystem When to use pyfabric and complementary Fabric tools
Vision Project mission and design principles
Roadmap Implementation phases and current status
API Reference All sub-packages and their public functions
Testing Guide Local testing with DuckDB Spark mock and pytest fixtures
AI Prompts Sample prompts for Claude and Copilot to create Fabric items
CONTRIBUTING.md Development setup and release process
CLAUDE.md Instructions for AI coding assistants

Sub-packages

Package Purpose Install
pyfabric.client Fabric REST API authentication and HTTP client pyfabric[azure]
pyfabric.items Create, validate, and manage Fabric item definitions (included)
pyfabric.data OneLake, SQL endpoint, and lakehouse table operations pyfabric[data]
pyfabric.workspace Workspace management (list, create, roles) pyfabric[azure]
pyfabric.testing DuckDB Spark mock, notebookutils mock, pytest fixtures pyfabric[testing]

Supply Chain Security

Every release of pyfabric includes supply chain security attestations:

  • SLSA Build Provenance — each release is built in GitHub Actions and attested with SLSA provenance, verifiable with gh attestation verify
  • SBOM (SPDX) — a Software Bill of Materials in SPDX JSON format is generated for every release and attached as a release asset
  • PyPI Trusted Publisher — packages are published to PyPI via OpenID Connect with no long-lived credentials
  • Dependency Review — every PR is scanned for known vulnerabilities via pip-audit and GitHub's dependency review action

Verifying a release

# Verify SLSA provenance of a downloaded package
gh attestation verify pyfabric-*.whl --repo Creative-Planning/pyfabric

# Download the SBOM for a specific release
gh release download v0.1.0a2 --repo Creative-Planning/pyfabric --pattern "*.spdx.json"

The SBOM for each release is available at: https://github.com/Creative-Planning/pyfabric/releases/download/<tag>/pyfabric-build.spdx.json

Requirements

  • Python 3.11 or later

Developer setup

After cloning, install dev dependencies and git hooks so that lint, format, type check, and tests run automatically before commit/push:

pip install -e ".[dev]"
pre-commit install
pre-commit install --hook-type pre-push

See CONTRIBUTING.md for full details.

Contributing

This project is maintained by Creative Planning. We do not accept external contributions at this time. You are welcome to fork and modify under the MIT license. See CONTRIBUTING.md.

License

MIT

Metadata

Release files for pyfabric 0.1.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfabric 0.1.16
File Size Uploaded Provenance Actions
pyfabric-0.1.16.tar.gz 346.0 kB With provenance Details for pyfabric-0.1.16.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyfabric 0.1.16
File Interpreter ABI Platform Actions
pyfabric-0.1.16-py3-none-any.whl Python 3 none any Details for pyfabric-0.1.16-py3-none-any.whl

Total release size: 554.4 kB

Release files / pyfabric-0.1.16.tar.gz

Download URL pyfabric-0.1.16.tar.gz
Size 346.0 kB
Tags Source
SHA-256 checksum
How to use checksums
570fca290e5d05c25c094ad0f10dd3915ce1e79a671e1552d2589c1fd34261bc
BLAKE2b-256 checksum
How to use checksums
56b85b1dc49286e0b349268479acd4a723cf86819d4766f440f4121577ffc518
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / pyfabric-0.1.16-py3-none-any.whl

Download URL pyfabric-0.1.16-py3-none-any.whl
Size 208.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54efdb75fa6c12c7930bd81373f56aedd56c9b0cedb7ac9cdf6977e5e1ce0b81
BLAKE2b-256 checksum
How to use checksums
f2354ab235b4657d7e38f3c26ac5c1e406ceb60f24dba1cc16c4a3ad445fbd84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for pyfabric 0.1.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyfabric-0.1.16.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.16 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page