About
pyDEXPI is an open-source Python tool for the DEXPI standard. DEXPI is a "Data Exchange in the Process Industry". It represents relevant information from Piping and Instrumentation Diagrams (P&IDs).
Design & MediaWhat you can do
- Import and export: load and save DEXPI XML and JSON, import legacy Proteus XML, and inspect parsing diagnostics.
- Analyze and query: find objects, inspect connectivity and paths with the Query API, and work with NetworkX graphs.
- Visualize: render diagrams and component symbols to SVG, with optional PNG and PDF exports.
- Automate: use Python for integrations, the CLI for conversions and exports, and MCP tools for agent-driven model workflows.
Measured star growth
- in 24h
- +1
- in 7 days
- +2
- in 15 days
- +7
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalpyDEXPI by 
Overview
pyDEXPI is an open-source engineering toolkit for working with Process Flow Diagrams (PFDs) and Piping and Instrumentation Diagrams (P&IDs) using the DEXPI standard. It brings together import/export, analysis, visualization, and validation through a Python library, command-line interface (CLI), and Model Context Protocol (MCP) server.
Use pyDEXPI to integrate DEXPI models into engineering software, automate diagram workflows, or give AI agents structured tools to inspect models. Import diagnostics, model validation, and format-fidelity tests support reliable data exchange.
The official DEXPI specification defines the engineering information model. pyDEXPI builds on generated Pydantic classes with the tools needed to use that model in applications.
Implements DEXPI version 2.0.1 (pydexpi.DEXPI_SPEC_VERSION), and writes DEXPI 2.0.1 XML and
JSON. DEXPI 2.0 files are read too, converted to 2.0.1 as they load.
Features
- Import and export: load and save DEXPI XML and JSON, import legacy Proteus XML, and inspect parsing diagnostics.
- Analyze and query: find objects, inspect connectivity and paths with the Query API, and work with NetworkX graphs.
- Visualize: render diagrams and component symbols to SVG, with optional PNG and PDF exports.
- Automate: use Python for integrations, the CLI for conversions and exports, and MCP tools for agent-driven model workflows.
- Generate synthetic P&IDs: assemble diagram patterns you provide for research and AI/ML datasets.
Choose your interface
| Interface | Use it for | Start here |
|---|---|---|
| Python library | Integrations, analysis, and rendering | Python usage |
CLI (pydexpi) |
Model summaries, format conversion, rendering, and table/graph exports | Command-line usage |
MCP server (pydexpi-mcp) |
Let an LLM client load, query, validate, and export models | MCP setup |
Citation
Please reference this software package as:
@InProceedings{pyDEXPI,
author = {Goldstein, Dominik P. and Schulze Balhorn, Lukas and Alimin, Achmad Anggawirya and Schweidtmann, Artur M.},
booktitle = {Proceedings of the 35th European Symposium on Computer Aided Process Engineering (ESCAPE35)},
title = {pyDEXPI:{A} {Python} framework for piping and instrumentation diagrams using the {DEXPI} information model},
year = {2025},
address = {Ghent, Belgium},
month = {July},
doi = {https://doi.org/10.69997/sct.139043},
}
Table of contents
- Overview
- Table of contents
- Documentation
- Installation
- Command-line usage
- MCP server
- Getting started with pyDEXPI
- Development
- Relevant applications and references
- Contributors
- Copyright and license
- Contact
Documentation
The documentation covers Python workflows, the CLI, and MCP, with application examples and an API reference.
Installation
Install the pyDEXPI package via
pip install pydexpi
or from GitHub via:
pip install git+https://github.com/process-intelligence-research/pyDEXPI
Alternatively, get the latest updates by cloning the repo and installing the editable version of the package with:
git clone https://github.com/process-intelligence-research/pyDEXPI
cd pyDEXPI
pip install .
Command-line usage
Install the CLI extra to use the pydexpi command:
pip install pydexpi[cli]
It wraps the most common pyDEXPI workflows so you can use them without writing Python.
# Print a model summary
pydexpi info data/reference_pid.xml
# Convert XML to JSON (or JSON to XML)
pydexpi convert data/reference_pid.xml -o output.json
# Render a P&ID to SVG
pydexpi svg data/reference_pid.xml -o diagram.svg
# Export equipment / line / instrument / valve tables to styled Excel
pydexpi export-table data/reference_pid.xml -o tables
# Same tables with German headers and sheet names
pydexpi export-table data/reference_pid.xml -o tabellen --language de
# Export the plant graph as GraphML
pydexpi export-graph data/reference_pid.xml -o graph.graphml --level process
Run pydexpi --help or pydexpi <command> --help for full option details.
See CLI guide for comprehensive documentation.
MCP server
pyDEXPI includes a Model Context Protocol server, so LLM
clients such as Claude Desktop, Claude Code and Cursor can load, query and export DEXPI
models. Install the mcp extra and register the pydexpi-mcp command with your client:
pip install "pydexpi[mcp]"
claude mcp add pydexpi -- pydexpi-mcp # Claude Code
The server runs over stdio by default, or over streamable HTTP / SSE with a separate session per client. See docs/mkdocs/mcp.md for its tools, resources, transports and client configuration.
Getting started with pyDEXPI
from pydexpi.loaders import DexpiXmlSerializer
directory_path = "data"
filename = "reference_pid.xml"
my_loader = DexpiXmlSerializer()
dexpi_model = my_loader.load(directory_path, filename)
Development
Install the development dependencies and use the helper scripts in scripts/:
pip install -e ".[dev,export,cli,mcp]"
./scripts/lint # format and lint with ruff
./scripts/test # run the test suite with coverage
Both run on every pull request. The export, cli and mcp extras are installed in CI as well,
so the SVG/PNG/PDF conversion tests, the CLI suite and the MCP server suite run rather than skip.
./scripts/test measures coverage and fails if it drops below the floor in
[tool.coverage.report] fail_under in pyproject.toml. The floor is seeded at
the value measured when it was introduced, not at an aspirational number: it is there to stop
coverage sliding backwards, so raise it as coverage improves. Set COVERAGE=0 when running a
subset, since a partial run measures partial coverage and would trip the floor:
COVERAGE=0 ./scripts/test -k loaders
A full run writes htmlcov/index.html for browsing uncovered lines, and coverage.json, which
scripts/coverage_report.py renders as a per-package summary. CI publishes that summary to the
workflow's Summary tab on every pull request and uploads both files as an artifact, including
when the run fails.
Format-fidelity tests
tests/test_roundtrip/ checks the invariant that composes the
serializers rather than any one of them: a document that is exported and reloaded must be the same
document, across DEXPI XML and JSON. Proteus XML takes part as a source only -- its export path
was discontinued in v1.2.0 and raises, which the suite pins down rather than works around. It
covers golden-file round-trips over
data/reference_pid.xml, export determinism, a corpus sweep over data/, and property-based
round-trips of generated models via hypothesis.
Paths that are known to be broken carry strict xfail markers naming the issue that owns them, so
an xfail turning into a pass is a build failure that says "delete this marker" -- each of those
issues has an objective definition of done. Point PYDEXPI_CORPUS_DIR at a directory of DEXPI
files to include them in the corpus sweep, and run a deeper property search with:
COVERAGE=0 ./scripts/test -k roundtrip --hypothesis-profile=thorough
Relevant applications and references
Vision of GenAI for process engineering
- Schweidtmann, A. M. (2024). Generative artificial intelligence in chemical engineering. Nature Chemical Engineering, 1(3), 193-193. https://doi.org/10.1038/s44286-024-00041-5
Chat interface for P&IDs using Large Language Models (LLMs)
- Alimin, A. A., & Schweidtmann, A. M. (2026). GraphRAG for Engineering Diagrams: ChatP&ID Enables LLM Interaction with P&IDs. arXiv preprint arXiv:2603.22528. https://doi.org/10.48550/arXiv.2603.22528
- Alimin, A. A., Goldstein, D. P., Schulze Balhorn, L., & Schweidtmann, A. M. (2025). Talking like piping and instrumentation diagrams (p&ids). Proceedings of the 35th European Symposium on Computer Aided Process Engineering (ESCAPE35), Ghent, Belgium. https://doi.org/10.69997/sct.159477
Error correction of P&IDs
Schulze Balhorn, L., Seijsener, N., Dao, K., Kim, M., Goldstein, D. P., Driessen, G. H., & Schweidtmann, A. M. (2025). Rule-based autocorrection of Piping and Instrumentation Diagrams (P&IDs) on graphs. Proceedings of the 35th European Symposium on Computer Aided Process Engineering (ESCAPE35), Ghent, Belgium. https://doi.org/10.69997/sct.150968
Schulze Balhorn, L., Caballero, M., & Schweidtmann, A. M. (2024). Toward autocorrection of chemical process flowsheets using large language models. In Computer Aided Chemical Engineering (Vol. 53, pp. 3109-3114). Elsevier. https://doi.org/10.1016/B978-0-443-28824-1.50519-6
Schulze Balhorn, L., Seijsener, N., Dao, K., Kim, M., Goldstein, D. P., Driessen, G. H., & Schweidtmann, A. M. (2025). Rule-based autocorrection of Piping and Instrumentation Diagrams (P&IDs) on graphs. Proceedings of the 35th European Symposium on Computer Aided Process Engineering (ESCAPE35), Ghent, Belgium. https://doi.org/10.69997/sct.150968
Schulze Balhorn, L., Caballero, M., & Schweidtmann, A. M. (2024). Toward autocorrection of chemical process flowsheets using large language models. In Computer Aided Chemical Engineering (Vol. 53, pp. 3109-3114). Elsevier. https://doi.org/10.1016/B978-0-443-28824-1.50519-6
Process development
- Vogel, G., Schulze Balhorn, L., & Schweidtmann, A. M. (2023). Learning from flowsheets: A generative transformer model for autocompletion of flowsheets. Computers & Chemical Engineering, 171, 108162. https://doi.org/10.1016/j.compchemeng.2023.108162
- Schulze Balhorn, L., Hirtreiter, E., Luderer, L., & Schweidtmann, A. M. (2023). Data augmentation for machine learning of chemical process flowsheets. In Computer Aided Chemical Engineering (Vol. 52, pp. 2011-2016). Elsevier. https://doi.org/10.1016/B978-0-443-15274-0.50320-6
- Hirtreiter, E., Schulze Balhorn, L., & Schweidtmann, A. M. (2024). Toward automatic generation of control structures for process flow diagrams with large language models. AIChE Journal, 70(1), e18259. https://doi.org/10.1002/aic.18259
- Schulze Balhorn, L., Degens, K., & Schweidtmann, A. M. (2025). Graph-to-SFILES: Control structure prediction from process topologies using generative artificial intelligence. Computers & Chemical Engineering, 109121. https://doi.org/10.1016/j.compchemeng.2025.109121
Digitization of paper P&IDs to smartP&IDs
- Theisen, M. F., Flores, K. N., Schulze Balhorn, L., & Schweidtmann, A. M. (2023). Digitization of chemical process flow diagrams using deep convolutional neural networks. Digital chemical engineering, 6, 100072. https://doi.org/10.1016/j.dche.2022.100072
- Digitization Companion
Contributors
![]() |
Dominik P. Goldstein | |
![]() |
Lukas Schulze Balhorn | |
![]() |
Achmad Anggawirya Alimin | |
![]() |
Artur M. Schweidtmann | |
Copyright and license
This software is released under the OSI-approved GNU Affero General Public License (AGPL-3.0) license (see license file file for details). We believe in open collaboration and knowledge sharing, and encourage use by students, researchers, open-source contributors, and industry. You are free to use, modify, and distribute the software under the given license terms. This is a copyleft license, which means that any software based on pyDEXPI, or any modified version thereof, must be published under the same open-source license.
Third-party material. pyDEXPI's generated DEXPI classes (pydexpi/pydexpi_classes/) are an
adaptation of the DEXPI Specification 2.0.1, and data/reference_pid.xml contains the reference
P&ID of the DEXPI Specification 2.0, both (c) DEXPI (DEXPI e.V.) and licensed under
CC BY 4.0. NOTICE gives their
attribution and the changes made.
Commercial or Proprietary Use?
If you would like to:
- Use this software in a proprietary or closed-source product,
- Use it in a way that is not compatible with AGPL copyleft obligations, or
- Obtain dedicated support or feature extensions,
We’re happy to discuss a commercial or custom license on a case-by-case basis.
Please reach out to us for more information.
Technische Universiteit Delft hereby disclaims all copyright interest in the program “pyDEXPI” - a Python tool for the DEXPI standard - written by Artur M. Schweidtmann. Paulien Herder, Dean of Applied Science
Copyright (C) 2025-2026 Artur Schweidtmann.
Contact
Artur Schweidtmann
📧 Contact
Process Intelligence Research Group
Explore related projects
Loading…



