epam / Indigo

Universal cheminformatics toolkit, utilities and database search tools
http://lifescience.opensource.epam.com
Apache License 2.0
291 stars 100 forks source link

`setOption` render options are invalid until IndigoRenderer is created. #1909

Open twall opened 2 months ago

twall commented 2 months ago

Rendering options such as "render-output-format" are not considered valid until an IndigoRenderer object is created.

Steps to Reproduce Using indigo-1.18.0, python 3.11

from indigo import Indigo
indigo = Indigo()
indigo.setOption("render-output-format")

Expected behavior setOption should accept the valid parameter.

Actual behavior File ".../python3.11/site-packages/indigo/indigo/indigo.py", line 140, in setOption IndigoLib.checkResult( File ".../site-packages/indigo/indigo/indigo_lib.py", line 1005, in checkResult raise exception_class(IndigoLib.lib.indigoGetLastError()) indigo.indigo.indigo_exception.IndigoException: option manager: Property "render-output-format" not defined

Why does the render parameter suddenly become valid after creating a seemingly unrelated object? It is certainly unexpected that it is only possible to set a render option on the Indigo object after creating an IndigoRenderer, with that indigo object as a parameter. If the option is specific to the renderer, I would expect it to be an option on the renderer object.

AlexanderSavelyev commented 2 months ago

Hi @twall , thanks for the suggested way to have options inside renderer object. It definitely makes sense to put it inside the relevant object from object oriented programming. The current approach was implemented using the API (e.g. REST and WASM) where all the options are inside one key-value container and can be used in one function. I think we can improve the error message so that it is more clear that use need to create indigorenderer object, or fully remove indigo renderer - but it is only future plans