You could go through all methods in KubeLibrary and add robot_name attribute to them (this is what @keyword does) before passing them to DynamicCore.
Enhancing PythonLibCore so that it supports also static libraries as library components could be considered as well. It probably wouldn’t require anything more than having a wrapper that can add those robot_name attributes as part of PLC. If you get this working with a custom solution, please submit an issue to PLC about it as well.
Is there some robot framework native way, how to go through the library and get only keywords? Or I just need to do something like [kw for kw in dir(lib_instance) if not kw.startswith("__")] ? or is there better way?
Robot’s own logic for figuring out what keywords a static library containx isn’t exposed so that it could be easily used externally. Your example is already pretty good, but I’d enhance it a bit to something like this:
for name, kw in inspect.getmembers(lib):
if name != '_' and callable(kw) and not hasattr(kw, 'robot_name'):
kw.__func__.robot_name = None
The above works with library instances where keywords are methods and kw.__func__.robot_name is needed. With library modules you probably should just use kw.robot_name. Probably not relevant for you, but needed to taken into account with a generic solution.
Did you try using from KubeLibrary import KubeLibrary work? That Importer mainly handles imports by path like path/lib.py and provides better error reporting, but for importing normal modules just the standard import ought to work. You can obviously use it, but it’s not part of the stable public API so there’s a risk it changes in the future.
For logging I’d also recommend robot.api.logger instead of BuiltIn.log. Finally, setting robot_name is enough, no need to set robot_tags.
I just created some kind of ‘plugin’ api for this ones… I can change it, it should be sufficient, but my ‘plugin’ implementation is also working with importer, so if something will change in it, I need to change also my implementation.
As for the robot_tags it is required, I got errors
[ ERROR ] Error in library 'IllumioCloudLibrary': Adding keyword 'read_namespaced_persistent_volume_claim' failed: Calling dynamic method 'get_keyword_tags' failed: AttributeError: 'function' object has no attribute 'robot_tags'