A Python library for reading and parsing Functional Mock-up Interface model description XML file.
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
mdreader 📖
A Python library for reading and parsing Functional Mock-up Interface (FMI 2.0 and 3.0) model description XML files into Pydantic models.
Installation 📦
Add mdreader to your pyproject.toml with uv with:
uv add mdreader
To install
uv, see https://docs.astral.sh/uv/getting-started/installation/
How to use 🚀
To read and parse an FMI model description (works for both 2.0 and 3.0):
import mdreader.fmi2 as fmi2
import mdreader.fmi3 as fmi3
# Read from XML file
md = fmi2.read_model_description("path/to/fmi2/modelDescription.xml") # or fmi3.read_model_description for 3.0
# Read from FMU archive
md = fmi2.read_model_description("path/to/model.fmu") # or fmi3.read_model_description for 3.0
# Read from unzipped FMU directory
md = fmi2.read_model_description("path/to/unzipped/fmu/directory") # or fmi3.read_model_description for 3.0
print(md)
Features ✨
- Parse FMI 2.0 and 3.0 model description XML files
- Read model information from FMU archives
- Access model metadata (name, version, author, GUID, etc.)
- Extract variable definitions (real, integer, boolean, string, enumeration, clock, binary)
- Access unit definitions and type definitions
- Support for Model Exchange, Co-Simulation, and Scheduled Execution interfaces
- Parse model structure, dependencies, and experiment configurations
- Full support for FMI 3.0 features including structural parameters, clock variables, and directional derivatives
Why another FMI model description reader? 🤔
- Lightweight: mdreader only depends on Pydantic
- De/Serialization: Pydantic models support easy serialization to/from JSON, dict, etc.
- Validation: mdreader uses Pydantic models to ensure the integrity of the parsed data
- FMI version specific: The
fmi2.FMIModelDescriptionandfmi3.FMIModelDescriptionclasses are specific to their respective FMI versions (not a mix of versions), making it simpler to use for each version
Related projects 🔗
- fmpy: A similar
read_model_descriptionfunction is available in FMPy, but it uses custom classes instead of Pydantic models and has more dependencies.
Licensing 📄
The code in this project is licensed under MIT license. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mdreader-0.2.0rc0.tar.gz.
File metadata
- Download URL: mdreader-0.2.0rc0.tar.gz
- Upload date:
- Size: 31.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e875d76647e024fbd45f039e3a28cdd2c7dd8bb7e078d001eac4ebb1069c072d
|
|
| MD5 |
a6c229b22387df9eca021675839de964
|
|
| BLAKE2b-256 |
07a250c27457d710c9fc5f606aeedc5aded25cdc2f47f5e3b9a93fa3b0d49547
|
File details
Details for the file mdreader-0.2.0rc0-py3-none-any.whl.
File metadata
- Download URL: mdreader-0.2.0rc0-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7deb631324f2178c940817c80a8140d6b417093cb7c3a3e22aac31a28b4cfcd7
|
|
| MD5 |
79eae573238fa65254987f0b1f5a36cb
|
|
| BLAKE2b-256 |
57ff67d148e71b3f559a0f26702385e2c590e02fca78e954ec27f37bca3ac80b
|