Python libraries helping AI coding assistants create and locally validate Microsoft Fabric items compatible with Fabric git sync.
Project description
pyfabric
Python library for creating, validating, and locally testing Microsoft Fabric items that are compatible with Fabric git sync.
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[testing] # DuckDB Spark mock and pytest fixtures
pip install pyfabric[all] # All optional dependencies
Quick start
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
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 |
|---|---|
| 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] |
Requirements
- Python 3.12 or later
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyfabric-0.1.0a2.tar.gz.
File metadata
- Download URL: pyfabric-0.1.0a2.tar.gz
- Upload date:
- Size: 88.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbb9e16cad582938f4ad86ba81a5a94d695cbf4b842e74f5518b62da9e136651
|
|
| MD5 |
5048cfba8b979bb9e493a127f7b95e70
|
|
| BLAKE2b-256 |
d152e145aadc7df1be895347e513534bf5e937ff2e1a7b96880fda42a9db931f
|
Provenance
The following attestation bundles were made for pyfabric-0.1.0a2.tar.gz:
Publisher:
publish.yml on Creative-Planning/pyfabric
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyfabric-0.1.0a2.tar.gz -
Subject digest:
bbb9e16cad582938f4ad86ba81a5a94d695cbf4b842e74f5518b62da9e136651 - Sigstore transparency entry: 1285430691
- Sigstore integration time:
-
Permalink:
Creative-Planning/pyfabric@c376aa9513a01095a1815365b61f0b215e63b27a -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/Creative-Planning
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c376aa9513a01095a1815365b61f0b215e63b27a -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyfabric-0.1.0a2-py3-none-any.whl.
File metadata
- Download URL: pyfabric-0.1.0a2-py3-none-any.whl
- Upload date:
- Size: 57.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76c7983b9d5f240c4849b972958d2b0abd9ed893d555cb2d6fac32e67aff690d
|
|
| MD5 |
b4f8eaa807fa3ad7dbc1aa45488b51a5
|
|
| BLAKE2b-256 |
a944082875aa682c1abdd06445f8744583588c6956753671e86bb2287da94aa8
|
Provenance
The following attestation bundles were made for pyfabric-0.1.0a2-py3-none-any.whl:
Publisher:
publish.yml on Creative-Planning/pyfabric
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyfabric-0.1.0a2-py3-none-any.whl -
Subject digest:
76c7983b9d5f240c4849b972958d2b0abd9ed893d555cb2d6fac32e67aff690d - Sigstore transparency entry: 1285430778
- Sigstore integration time:
-
Permalink:
Creative-Planning/pyfabric@c376aa9513a01095a1815365b61f0b215e63b27a -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/Creative-Planning
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c376aa9513a01095a1815365b61f0b215e63b27a -
Trigger Event:
release
-
Statement type: