OMPython icon indicating copy to clipboard operation
OMPython copied to clipboard

Conversion guide to upgrade to OMPython 4

Open AnHeuermann opened this issue 4 months ago • 2 comments

Description

Is there a write up of the main breaking changes in OMPython v4.0.0?

While trying to update OMPython in https://github.com/OpenModelica/OpenModelicaLibraryTesting I noticed some breaking changes. It would be nice if there was some place in the documentation telling users how to upgrade.

Breaking changes I noticed:

  • Class OMCSessionZMQ no longer accepts Docker arguments --> I found a new class OMCProcessDocker which does and used that one.
  • Module pyparsing is no longer exported.
  • omc.sendExpression('exit') no longer works --> omc.sendExpression('quit()') or simply let the class destruction handle it.

Are there more mayor changes?

AnHeuermann avatar Nov 12 '25 09:11 AnHeuermann

@AnHeuermann Thanks for your work an this; below my comments; see also issue #372 and #374

  • OMCSessionZMQ was splitted into several parts:
    • OMCSessionZMQ => handling of interactions with OMC
    • OMCProcess* => responsible for the connection to the OMC process; local, port, docker and WSL possible
    • OMCSesionCMD => OMC API, to be removed (see #276)
    • => using this structure and the other changes ModelicaSystem can be used with OMC local, via docker or via WSL
  • why would you need pyparsing directly? if needed it should be imported
  • I'm not aware of any change regarding omc.sendExpression('exit') - was this working before? I did not found any code handling this in v3.6.0

other (breaking?) changes:

  • rework of file structure - should not be visible to the user
  • updated handling of linearisation; see LinearizationResult - should be compatible
  • use of ModelicaSystemCmd - should also not be directly visible to the user
  • simargs for ModelicSystem.simulation() - simflags depreciated

in v4.1.0:

  • update of set*() functions - use a dictionary instead of string based definition; old version still working but depreciated
  • use of OMCPath - compatibility layer for Python < 3.12; limited functionality
  • update ModelicaSystem interface - split class initialisation and model definition (this will fix convertFmo2Mo())

planned for v4.1.0:

  • finish fix for convertFmo2Mo()
  • rename variables - breaking change (in my v4.1.0-test branch; not available as PR for now)

future (v5.0.0):

  • remove support of Python < 3.12 (OMCPath) - PR #346
  • set*() function - suport only *kwargs - PR #347
  • remove simflags for simulate() - PR #308

feel free to ask if you need more information

syntron avatar Nov 13 '25 21:11 syntron

why would you need pyparsing directly? if needed it should be imported

Yes, that is the better way and how I changed it. It was used to catch some specific parsing error.

AnHeuermann avatar Nov 14 '25 09:11 AnHeuermann