Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

twbparser-py

A native Python port of the twbparser R package: parses Tableau .twb/.twbx workbook files into pandas DataFrames. No R runtime required — pure lxml XML parsing.

This is a v1 subset covering the parser's core: workbook loading, datasources, parameters, fields, calculated fields, joins, relationships (legacy and 2020.2+), inferred relationships, dashboards, relationship validation, custom/initial SQL, and published-source detection. Formatting/tooltips/colors/axes/sorts, dashboard layout/actions, analytics helpers (calc complexity, field usage, replication brief), and the Shiny-inspector equivalent are not yet ported.

Beyond the R original, this port also adds a few Python-native extras: a Graphviz DOT export of the relationship graph, a workbook-to-workbook diff, folder/batch analysis across many workbooks, and Jupyter rich display (_repr_html_).

Install

pip install -e .

Usage

from twbparser_py import TwbParser

p = TwbParser("workbook.twb")  # or .twbx
p.get_datasources()
p.get_fields()
p.get_calculated_fields()
p.get_joins()
p.get_relationships()
p.get_inferred_relationships()
p.get_dashboards()
p.get_dashboard_sheets()
p.get_custom_sql()
p.get_initial_sql()
p.get_published_refs()
p.get_relationship_graph_dot()   # Graphviz DOT string
p.validate()
p.get_overview()
p  # in Jupyter: renders get_overview() via _repr_html_

from twbparser_py import diff_workbooks, scan_folder

diff_workbooks(TwbParser("v1.twb"), TwbParser("v2.twb"), table="datasources")
scan_folder("./workbooks", table="datasources")  # one row per workbook x datasource

CLI

twbparser workbook.twb                              # overview (default table)
twbparser workbook.twb tables                        # list available tables
twbparser workbook.twb calculated-fields             # print a table
twbparser workbook.twb fields --format csv -o fields.csv
twbparser workbook.twbx dashboard-sheets --dashboard "Sales Overview"
twbparser workbook.twb validate                       # exit code 2 if invalid
twbparser workbook.twb graph --include-inferred > relationships.dot
twbparser diff old.twb new.twb datasources             # row-level added/removed
twbparser batch ./workbooks datasources                # one table, every workbook in a folder

Tables: overview, datasources, parameters, fields, raw-fields, calculated-fields, joins, relations, relationships, inferred-relationships, dashboards, dashboard-sheets, custom-sql, initial-sql, published-refs. --format is table (default), csv, or json (graph always prints Graphviz DOT text regardless of --format). diff/batch accept most of the same table names, minus graph/validate/tables.

GUI

A local, browser-based GUI — standard library only (http.server + vanilla JS), no GUI toolkit or extra dependency required:

twbparser-gui workbook.twb   # opens your default browser
twbparser-gui                # opens with an empty path field; paste one and click Load
twbparser-gui --no-browser --port 8765   # just run the server, e.g. for a headless box

Pick a table from the dropdown, filter dashboard-sheets by dashboard, toggle "include Parameters" for calculated-fields, pick graph to preview/export a Graphviz DOT digraph of the relationships, and export any tabular view as CSV. All state lives server-side in memory for the life of the process — it's a single-user local tool, not something to expose on a shared network.

Testing

pip install -e ".[test]"
pytest

Fixtures in tests/fixtures/ are the same tiny sample workbooks used by the original R package's test suite (inst/extdata/).

The GUI additionally has end-to-end tests that drive the page in a real headless Chromium (via Playwright) and fail on any uncaught JavaScript error. They're opt-in — without the browser installed they skip and the rest of the suite runs normally:

pip install -e ".[test,browser]"
playwright install chromium          # add --with-deps if you have root
./scripts/setup-browser-libs.sh      # no-root alternative to --with-deps
pytest tests/test_gui_browser.py

Background

.twb is plain XML, and .twbx is just a zip wrapper around one, which is why parsing it natively in Python — no R, no reverse-engineering — was tractable at this scale. Power BI's equivalent format, .pbix, is a binary container built around the proprietary VertiPaq storage engine, which is why reading it programmatically needed dedicated reverse-engineering projects like PBIXRay and pbi-tools. The comparison isn't one-sided, though: Tableau's own official Python tooling for server automation (tableauserverclient, tabcmd) is more mature and more open than anything Microsoft ships for Power BI's REST API.

Credit

Ported from the R implementation by George Arthur (PrigasG/twbparser), MIT licensed.

Release files for py-tbparse 0.1.1a0

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

Source distribution (sdist)

Source distribution for py-tbparse 0.1.1a0
File Size Uploaded
py_tbparse-0.1.1a0.tar.gz 1.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-tbparse 0.1.1a0
File Interpreter ABI Platform
py_tbparse-0.1.1a0-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / py_tbparse-0.1.1a0.tar.gz

Download URL py_tbparse-0.1.1a0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
a9225e81288e5886e9aa130cdf2421c97ed5c14eabda5cfe60a9e4714e43ac0e
BLAKE2b-256 checksum
How to use checksums
746cabff049f47143731b586729a1a73773ed48ab792d0517b33a667fb5f2cff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release files / py_tbparse-0.1.1a0-py3-none-any.whl

Download URL py_tbparse-0.1.1a0-py3-none-any.whl
Size 37.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9082c767b76260c5a6e37e2322f6d0d1795230bb042aed145bfcf5514c048dd3
BLAKE2b-256 checksum
How to use checksums
b7db0a6c024963b473d54ae0062dab65ae6bea0494e67e9942deda061329add5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1a0 This release

2 release files

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