semvec/pypi-packages huggingface dataset:
riff-pbix 0.1.0
Parse Power BI PBIX files and generate a structured app plan.
License: MIT
Requires Python: >=3.9

 # riff-pbix
 
 Parse Power BI `.pbix` files and generate a structured app plan.
 
 ## Install
 
 ```bash
 pip install riff-pbix
 ```
 
 ## Quick start
 
 ```python
 import zipfile
 from riff_pbix import (
     parse_report_layout,
     parse_data_model,
     parse_mashup,
     parse_connections,
     infer_model_from_references,
     build_lineage,
     generate_plan,
 )
 
 with zipfile.ZipFile("report.pbix") as z:
     layout = parse_report_layout(z)
     model = parse_data_model(z)
     mashup = parse_mashup(z)
     connections = parse_connections(z)
 
 if not model or model.get("is_missing"):
     model = infer_model_from_references(layout.get("all_visuals_flat", []))
 
 lineage = build_lineage(
     layout.get("all_visuals_flat", []),
     model,
     mashup.get("queries", []) if mashup else [],
 )
 
 analysis_result = {
     "filename": "report.pbix",
     "parsed_layout": layout,
     "parsed_model": model,
     "parsed_mashup": mashup,
     "connections": connections,
 }
 
 plan = generate_plan(analysis_result)
 print(plan.json(indent=2))
 ```
 
## CLI

Generate a plan JSON from a PBIX file:

```bash
riff-pbix path\to\report.pbix --pretty
```

Output the full analysis payload:

```bash
riff-pbix path\to\report.pbix --analysis --pretty
```

Write output to a file:

```bash
riff-pbix path\to\report.pbix --output report_plan.json --pretty
```

 ## Notes
 
 - The parser reads the PBIX as a zip archive and extracts `Report/Layout`,
   `DataModelSchema`, `DataMashup`, and `Connections` when present.
 - If the model is missing, you can infer a lightweight model from visual usage.