Pydantic v2 models for the ISA-95 manufacturing operations standard, with B2MML-conformant JSON aliases built in.
A small, hand-curated Python library that gives you typed and validated classes for the durable object model of ISA-95 — the international standard (ANSI/ISA-95, IEC 62264) for integration between business systems (ERP, PLM) and manufacturing operations (MES, MOM, shop floor). Field names round-trip cleanly with B2MML-compliant systems like SAP Digital Manufacturing, Plex, GE Proficy, and Aveva.
The MESA International schemas have been the lingua franca for moving manufacturing data between business systems and the plant floor for two decades. Java and .NET shops have had first-class B2MML libraries that whole time. Python has not — until now there was no maintained idiomatic Python binding that lets you say "give me a MaterialLot" and have it round-trip JSON with SAP DM or any other B2MML-aware system without writing translation code by hand.
pyb2mml closes that gap.
uv add pyb2mml
# or
pip install pyb2mmlThe only runtime dependency is pydantic >= 2.6.
from pyb2mml import MaterialLot, Quantity, MaterialLotStatus
# Construct in idiomatic Python (snake_case)
lot = MaterialLot(
id="LOT-2026-W22-001",
description=["First production lot of widget v3"],
material_definition_id="WIDGET",
quantity=Quantity(quantity_string=100, unit_of_measure="kg"),
status=MaterialLotStatus.Released,
)
# Serialize to canonical B2MML-JSON (PascalCase, acronyms preserved)
lot.model_dump_json(by_alias=True, exclude_none=True)
# {"ID":"LOT-2026-W22-001","MaterialDefinitionID":"WIDGET","Quantity":{...},"Status":"Released",...}
# Parse a B2MML-JSON payload from SAP DM / Plex / Proficy
incoming = {
"ID": "LOT-FROM-SAP",
"MaterialDefinitionID": "GADGET",
"Quantity": {"QuantityString": "7.5", "UnitOfMeasure": "kg", "DataType": "decimal"},
"Status": "Released",
}
lot2 = MaterialLot.model_validate(incoming)
print(lot2.id, lot2.material_definition_id) # 'LOT-FROM-SAP' 'GADGET'No per-field aliases were written. The snake_case ↔ PascalCase mapping is handled globally by an acronym-aware alias generator on the shared base class — ID, BOD, MOM, RNC, QA stay uppercase, GRecipe stays mixed-case, everything else PascalCases regularly.
| ISA-95 Part | Topic | Module |
|---|---|---|
| Part 2 §5 | Personnel | pyb2mml.personnel |
| Part 2 §6 | Equipment | pyb2mml.equipment |
| Part 2 §6 (asset) | Physical Asset | pyb2mml.physical_asset |
| Part 2 §7 | Material | pyb2mml.material |
| Part 2 §8 / Part 4 §6 | Process Segment | pyb2mml.process_segment |
| Part 4 §7–10 | Operations (Definition, Capability, Schedule, Performance) | pyb2mml.operations |
| Part 4 §11–13 | Work (Master, Directive, Schedule, Performance, Calendar, Alert) | pyb2mml.work |
98 exported classes / enums in total. Read each module top-to-bottom and the model makes sense.
- XML wire format. B2MML is also published as XML; full XML round-trip is out of scope for v0.2. If you need to talk to SAP MII or other legacy XML interfaces, see 07-extending.md for the adapter pattern, or wait for a future
pyb2mml[xml]extra. - BOD message envelopes.
AcknowledgeMaterialDefinition,SyncEquipment, etc. are wire-protocol verbs, not ISA-95 model. They're MESA's transport layer; this library is about the durable model. - ISA-88 batch objects. Recipe, Procedure, Operation, Phase, Step — the ISA-88 model lives inside ISA-95's Process Cell level. Out of scope for v0.2 but a natural extension (see 07-extending.md).
Read the docs in order if you're new to ISA-95:
- 00-overview.md — what this is and what it isn't
- 01-isa95-primer.md — 10-minute primer on the standard
- 02-resource-model.md — the four parallel resource types
- 03-property-pattern.md — the universal Property pattern
- 04-process-segments.md — recipe-independent capability
- 05-operations.md — Operations: Definition, Capability, Schedule, Performance
- 06-work.md — Work: Master, Directive, Calendar, Alert
- 07-extending.md — subclassing, validators, custom domains
Alpha (v0.2). Model based on MESA International's B2MML V0701 (2023). MESA hasn't yet published a B2MML mapping for the 2025 ISA-95 Part 4 revision; this library tracks the MESA artifact and will follow when V0702 ships. See 01-isa95-primer.md for the relationship between ISA-95, MESA, and B2MML.
MIT. ISA-95 is © ISA / IEC; this library is an independent Python implementation of its conceptual model, not a derivative work of the standard text. B2MML schemas (referenced as a naming reference) are © MESA International, distributed under their own permissive license.