Skip to content
This repository was archived by the owner on Feb 8, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 20 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,39 @@
# mdreader
# mdreader 📖

A Python library for reading and parsing Functional Mock-up Interface (FMI2.0 currently) model description XML file.
A Python library for reading and parsing Functional Mock-up Interface (FMI2.0 currently) model description XML file into Pydantic models.

Pydantic models are used to represent the structure of the model description, providing type validation and easy access to model information.
[![PyPI version](https://badge.fury.io/py/mdreader.svg)](https://badge.fury.io/py/mdreader)

## Installation
## Installation 📦

It is suggested to add `mdreader` to your `pyproject.toml` with `uv` by running:
Add `mdreader` to your `pyproject.toml` with `uv` with:

```
``` bash
uv add mdreader
```

> To install `uv`, see https://docs.astral.sh/uv/getting-started/installation/

### Other installation options

Option 1: Add `mdreader` to an existing virtual environment with `uv`

```
uv pip install mdreader
```

Option 2: Add `mdreader` with `pip`

```
pip install -U mdreader
```
## How to use 🚀

## Getting started
To read and parse an FMI 2.0 model description:

```python
from mdreader.fmi2 import read_model_description

# Read from XML file
md = read_model_description("path/to/modelDescription.xml")

# Read from FMU file
# Read from FMU archive
md = read_model_description("path/to/model.fmu")

# Read from an unzipped fmu directory containing modelDescription.xml
md = read_model_description("path/to/directory")
# Read from unzipped FMU directory
md = read_model_description("path/to/unzipped/fmu/directory")

print(md)
```

## Features
## Features

- Parse FMI 2.0 model description XML files
- Read model information from FMU archives
Expand All @@ -53,18 +43,18 @@ md = read_model_description("path/to/directory")
- Support for both Model Exchange and Co-Simulation interfaces
- Parse model structure, dependencies, and experiment configurations

## Related projects

* [fmpy](https://github.com/CATIA-Systems/FMPy)

## Why another FMI model description reader?
## 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 exclusive**: The `fmi2.FMIModelDescription` class is specific to FMI 2.0 (not a mix of FMI1/2/3), making it simpler to use for that version

## Licensing
## Related projects 🔗

* [fmpy](https://github.com/CATIA-Systems/FMPy): A similar `read_model_description` function 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](LICENSE) file for details.