OMPython icon indicating copy to clipboard operation
OMPython copied to clipboard

Remove the OMC API functions

Open adeas31 opened this issue 10 months ago • 7 comments

Write now we have created wrapper functions for each OMC API. It is very difficult to keep track of API changes. OMPython is not directly linked with OMC so it is not possible to generate these wrapper functions automatically.

I suggest we remove these wrapper functions and clean up the code. The user can still call OMC API using sendExpression.

adeas31 avatar Apr 30 '25 10:04 adeas31

PR #282 prepares this; it removes all dependencies on OMCSessionBase - currently it keeps the code alive as OMCSessionCmd but if needed, this part can be removed

I have no feelings regarding this as I do not use the interface provided here ...

The main point to keep it would be that besides 4 function it is quite simple code now. The functions are:

  • getClassComment() - pyparsing.ParseException should be handled in sendExpression()
  • getParameterNames() - additional check for KeyError needed?
  • getParameterValue() - pyparsing.ParseException should be handled in sendExpression()
  • getNthComponentModification() - ???

syntron avatar May 03 '25 19:05 syntron

Write now we have created wrapper functions for each OMC API. It is very difficult to keep track of API changes. OMPython is not directly linked with OMC so it is not possible to generate these wrapper functions automatically.

I suggest we remove these wrapper functions and clean up the code. The user can still call OMC API using sendExpression.

@adeas31 is this backwards compatible? What happens to existing code using OMPython?

casella avatar Jun 02 '25 21:06 casella

Write now we have created wrapper functions for each OMC API. It is very difficult to keep track of API changes. OMPython is not directly linked with OMC so it is not possible to generate these wrapper functions automatically. I suggest we remove these wrapper functions and clean up the code. The user can still call OMC API using sendExpression.

@adeas31 is this backwards compatible? What happens to existing code using OMPython?

It will not be backwards compatible. Any script using these functions will not work.

At some time we need to take that jump. OMPython depends on OMC but is not directly linked to it. So we have hard coded all the OMC API functions which means there is no way to know if OMPython is broken because of a change in OMC API.

adeas31 avatar Jun 17 '25 07:06 adeas31

would this project a source for the OMC API? https://github.com/ijknabla/OpenModelicaCompilerForPython

I'm quite unsure about the relation to OMPython ...

syntron avatar Nov 16 '25 15:11 syntron

would this project a source for the OMC API? https://github.com/ijknabla/OpenModelicaCompilerForPython

No. This is not the source of OMC API. I have never seen this project before. OMC API is located here https://github.com/OpenModelica/OpenModelica/blob/master/OMCompiler/Compiler/FrontEnd/ModelicaBuiltin.mo

adeas31 avatar Nov 17 '25 09:11 adeas31

Interesting. I was also not aware of that.

casella avatar Nov 17 '25 15:11 casella

There seems to be some conversion of the OMC API into a yaml file which then is used to create the matching Python code - this looks like a (semi?) automated way to (re)create the OMC API in Python ...

syntron avatar Nov 17 '25 19:11 syntron