Skip to content

Migrating from pyDEXPI 1.x

pyDEXPI 2.1 implements DEXPI 2.0.1, where 1.x implemented DEXPI 1.3, so the classes and many import paths changed. To stay on DEXPI 1.3, pin the old version:

pip install "pydexpi<2"

Imports

1.x 2.1
pydexpi.dexpi_classes.* pydexpi.pydexpi_classes.*, split into core, plant and process
DexpiModel EngineeringModel
from pydexpi.loaders import ProteusSerializer from pydexpi.loaders.proteus_serializer import ProteusSerializer
pydexpi.loaders.svg_loader pydexpi.exports.svg_export

Loading

load_xml_file reads DEXPI XML and Proteus XML alike, so most code no longer needs a serializer:

from pydexpi import load_xml_file

model = load_xml_file("data/dexpi_training_test_cases/C01V04-VER.EX01.xml")

Loading is strict by default. Pass strict=False for a file that omits mandatory attributes. The object is then built without them and the omission is reported.

Existing files

  • Proteus XML loads as before, and is converted to the 2.0.1 classes.
  • DEXPI 2.0 XML and JSON convert to 2.0.1 as they load. A conversion that would copy or drop data is refused under strict=True and reported under strict=False.
  • JSON and pickle files written by 1.x hold DEXPI 1.3 classes, and there is no conversion from them. Load the original source file again and save the result.

Saved patterns

The sample patterns under data/dexpi_sample_patterns/ are gone, because they held DEXPI 1.3 classes. Patterns you saved with 1.x need rebuilding for the same reason. The generator itself is still in pydexpi.syndata; see Synthetic P&ID generation.

Which interfaces are stable

Public API and stability lists what 2.x keeps stable, and how a change to it is announced.