From a45ebac3d032d914f4fdd05eaf5ab56802606e09 Mon Sep 17 00:00:00 2001 From: syntron Date: Fri, 9 Jan 2026 09:55:23 +0100 Subject: [PATCH 1/3] update docstring of __init__.py - do not promote depreciated OMCSessionZMQ --- OMPython/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/OMPython/__init__.py b/OMPython/__init__.py index 59a0ad10..624ee64f 100644 --- a/OMPython/__init__.py +++ b/OMPython/__init__.py @@ -1,10 +1,14 @@ # -*- coding: utf-8 -*- """ OMPython is a Python interface to OpenModelica. -To get started, create an OMCSessionZMQ object: -from OMPython import OMCSessionZMQ -omc = OMCSessionZMQ() +To get started on a local OMC server, create an OMCSessionLocal object: + +``` +import OMPython +omc = OMPython.OMCSessionLocal() omc.sendExpression("command") +``` + """ from OMPython.ModelicaSystem import ( From d562870c77e5d4983e0212c0ac9121e52ee20d31 Mon Sep 17 00:00:00 2001 From: syntron Date: Sat, 8 Nov 2025 11:36:27 +0100 Subject: [PATCH 2/3] reorder imports in __init__.py --- OMPython/__init__.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/OMPython/__init__.py b/OMPython/__init__.py index 624ee64f..6c07920b 100644 --- a/OMPython/__init__.py +++ b/OMPython/__init__.py @@ -22,19 +22,20 @@ OMCPath, OMCSession, OMCSessionCmd, - OMCSessionException, - OMCSessionRunData, - OMCSessionZMQ, - OMCSessionPort, - OMCSessionLocal, OMCSessionDocker, OMCSessionDockerContainer, + OMCSessionException, + OMCSessionLocal, + OMCSessionPort, + OMCSessionRunData, OMCSessionWSL, + OMCSessionZMQ, ) # global names imported if import 'from OMPython import *' is used __all__ = [ 'LinearizationResult', + 'ModelicaSystem', 'ModelicaSystemCmd', 'ModelicaSystemDoE', @@ -44,12 +45,12 @@ 'OMCSession', 'OMCSessionCmd', + 'OMCSessionDocker', + 'OMCSessionDockerContainer', 'OMCSessionException', - 'OMCSessionRunData', - 'OMCSessionZMQ', 'OMCSessionPort', 'OMCSessionLocal', - 'OMCSessionDocker', - 'OMCSessionDockerContainer', + 'OMCSessionRunData', 'OMCSessionWSL', + 'OMCSessionZMQ', ] From f48f0bf29e52352b2dacb2ce78832dbeffef89d1 Mon Sep 17 00:00:00 2001 From: syntron Date: Sun, 18 Jan 2026 20:37:24 +0100 Subject: [PATCH 3/3] [OMCSession] use function keyword arguments if possible --- OMPython/OMCSession.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OMPython/OMCSession.py b/OMPython/OMCSession.py index c0e5499b..4f4f81a8 100644 --- a/OMPython/OMCSession.py +++ b/OMPython/OMCSession.py @@ -50,7 +50,7 @@ def poll(self): return None if self.process.is_running() else True def kill(self): - return os.kill(self.pid, signal.SIGKILL) + return os.kill(pid=self.pid, signal=signal.SIGKILL) def wait(self, timeout): try: @@ -854,10 +854,12 @@ def run_model_executable(self, cmd_run_data: OMCSessionRunData) -> int: return returncode def execute(self, command: str): - warnings.warn(message="This function is depreciated and will be removed in future versions; " - "please use sendExpression() instead", - category=DeprecationWarning, - stacklevel=2) + warnings.warn( + message="This function is depreciated and will be removed in future versions; " + "please use sendExpression() instead", + category=DeprecationWarning, + stacklevel=2, + ) return self.sendExpression(command, parsed=False)