tmdl-lens
Automated documentation generator for Power BI projects.
Reads TMDL files from a folder of .pbip reports and generates structured HTML or Markdown documentation for each one - covering data sources, tables, measures, relationships, M parameters, security roles, and calculation groups.
Runs as a standalone Windows desktop app. Output can be HTML (opens in any browser) or Markdown (README.md for GitHub). A live file watcher regenerates documentation automatically on every save.
What it documents
See a real example output generated from the included sample report.
Each generated README includes:
- Data Sources - connector type and resolved source detail for every query, covering 30+ connectors including SQL, Dataflows, SharePoint, Excel, OData, Azure storage, Fabric, Databricks, Snowflake, Salesforce, and more. Unknown connectors are auto-detected and flagged for manual labelling.
- Table Details - table type, source detail, and column list
- Measures - full DAX (optional), display folder, and format string
- Relationships - cardinality, cross-filter direction, and active/inactive state
- M Parameters - current value and which source expressions reference each parameter
- Security Roles - static and dynamic RLS rules per table, flagged by type
- Calculation Groups - calculation items with DAX and ordinal order
- Model Statistics - table, column, measure, and relationship counts
Installation
Option A - Run from source
Requires Python 3.12+.
git clone https://github.com/nox-magistralis/tmdl-lens.git
cd tmdl-lens
pip install -r requirements.txt
python main.py
Option B - Standalone executable
Download the latest tmdl-lens.exe from the Releases page. No Python or pip required - just run the .exe directly.
A config.json file will be created alongside the executable on first run to store your settings.
Note: Windows may show a SmartScreen warning on first run. Click More info then Run anyway. This is expected for unsigned applications.
Usage
- Launch the app
- Under Configure, set the Reports folder to the root of your
.pbipprojects - Set an Output folder if you want READMEs written somewhere other than next to each
.pbip - Press Run Now to generate documentation for all reports
- Enable Watch for TMDL changes to auto-regenerate on every save
If no output folder is set, each README.md is written next to its .pbip file. If a separate output folder is set, each report gets its own named subfolder inside it - for example docs/SalesReport/README.md, docs/FinanceReport/README.md - so multiple reports never collide.
Optional documentation metadata (owner, team, refresh schedule) is set in the Configure tab and stored in config.json next to the app. Values left blank are omitted from the generated output.
By default the app skips reports whose TMDL files and documentation settings have not changed since the last run - each report is hashed, and only reports that actually moved are regenerated. Turn this off with Skip reports with no TMDL changes in Configure.
On startup the app validates the config and logs a warning for a missing or empty reports folder, a missing output folder, a watch debounce outside 1-300, or an output format other than html or md.
Requirements
| Package | Version |
|---|---|
| customtkinter | >= 5.2.0 |
| watchdog | >= 4.0.0 |
Python 3.12 or later required when running from source.
Development
pip install -r requirements-dev.txt
python -m pytest
requirements-dev.txt adds dev-only dependencies (pytest, pyinstaller) on top of the base requirements.txt. The test suite runs against the bundled sample report and covers the TMDL parser, source resolution, config validation, and README/HTML generation.
Project structure
tmdl-lens/
main.py entry point
requirements.txt
requirements-dev.txt dev-only dependencies (pytest, pyinstaller)
pytest.ini
src/
app.py CustomTkinter UI
pipeline.py documentation generation pipeline
tmdl_parser.py TMDL file parser
source_resolver.py M expression source resolver
readme_generator.py README markdown generator
watcher.py file watcher (watchdog)
config.py app settings + documentation metadata (config.json)
sample/ sample .pbip project for testing
tests/ pytest suite
Author
Marcin Mozol - github.com/nox-magistralis
License
MIT - see LICENSE
Metadata
Release files for tmdl-lens 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tmdl_lens-0.4.0.tar.gz | 56.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tmdl_lens-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 109.0 kB
Release files / tmdl_lens-0.4.0.tar.gz
| Download URL | tmdl_lens-0.4.0.tar.gz |
|---|---|
| Size | 56.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41a0aa7c80ad818468918efd941a30dbf004c77ce1fb15fef973a85561895a83
|
|
BLAKE2b-256 checksum How to use checksums |
35706f3b3651a9aea4ec3a5903096487443124a1d736d60c62a1cac94656ed45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / tmdl_lens-0.4.0-py3-none-any.whl
| Download URL | tmdl_lens-0.4.0-py3-none-any.whl |
|---|---|
| Size | 52.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d6a08d1d59cc587f7d36d5cca7a4f62551337ef555e41b0306860482058822c
|
|
BLAKE2b-256 checksum How to use checksums |
276f4b24cfabd1181f77a6393f54201b24baaed8d680ecc96bd50df9bdc7b44e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|