A project to facilitate use of the MIKE Core components with Python, targeting Windows as well as Linux.
The MIKE Core Python classes have an API which is almost identical to the MIKE Core .NET API, to the extend possible. Since Python does not support all the language constructions that .NET/C# does (as e.g. method overriding), the API's are not completely identical. Also, the number of classes in the Python version is also smaller, since Python classes can be formed while being used. However, the examples and documentation for the .NET/C# API is to a high degree applicable also for the use of MIKE Core Python. For details, visit:
This library is the foundation for MIKE IO.
pip install mikecore
All commands are run from the project root.
-
Sync & Build
uv sync # Use 'uv sync --reinstall' to force-rebuild native components. -
Update EUM Types (for new release, or whenever EUM.xml changes)
# Generate definitions from the new native build uv run ./buildUtil/eumXMLProcess.py > eumItemUnit.txt # Use a diff tool to merge changes into mikecore/eum.py.
-
Run Tests
uv run pytest
-
Build Packages (Optional)
uv build
mikecore loads its bundled MIKE Core libraries by default, even with MIKE installed. With another library in the process that loads MIKE Core (a MIKE engine, for example):
- Linux: the two keep separate libraries, unless the other library is
loaded with
RTLD_GLOBALbefore mikecore. - Windows: each MIKE Core DLL is loaded once per process, by whichever library comes first, so the two can end up on a mix of versions.
To share one set instead, set MIKECORE_PYTHON_BIN to the installation's bin
folder (on Windows, the 64-bit bin\x64) before mikecore is first imported. On
Linux, you may also need that folder on LD_LIBRARY_PATH, and on Ubuntu 24.04
the installation's libraries may need sudo apt install libnsl2. mikecore is
only tested with its bundled libraries.
Either way, mikecore's EUM items and units match the bundled version. With
MIKE Core from a newer version, EUM lookups can raise ValueError
(#84), and data from it can
use items and units mikecore doesn't know. With an older version, newer items
and units are rejected.