You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way ProcessBlock subclasses are dynamically created through the @declare_process_block_class decorator is not compatible with tools that rely on static analysis of the code
This includes pylint, which prompted my initial analysis of the problem (see FIXME for details), and ultimately required the creation of a (fairly complex) pylint plugin
This also includes code IDEs, which severely limits the hints that can be provided to the user, in turn limiting the usability of IDAES as a platform
Changing the current API to one that's more friendly to static analysis is not a viable option because of backward compatibility concerns and the amount of effort it would require
To address this, I'm currently investigating a solutions based on type stub files (.pyi), which are companion files distributed alongside the code that allow providing type annotation information without modifying the actual code
The text was updated successfully, but these errors were encountered:
There is a similar issue with pandas/xarray accessor methods and IDE autocomplete. Finding out about stubs led me to this recent package which solves that issue for xarray: https://pypi.org/project/accessor-stubs/. The project description gives a good overview of the problem. It fixed my autocomplete issue by overwriting the .pyi files in a package xarray-stubs in my virtual environment (thanks for the tip!)
Perhaps a similar solution could autogenerate the ProcessBlock stubs. I think it is a similar problem, as xarray accessors are defined using decorators. Though it looks as if there is a more generalized stub generation tool built into mypy.
ProcessBlock
subclasses are dynamically created through the@declare_process_block_class
decorator is not compatible with tools that rely on static analysis of the code.pyi
), which are companion files distributed alongside the code that allow providing type annotation information without modifying the actual codeThe text was updated successfully, but these errors were encountered: