community icon indicating copy to clipboard operation
community copied to clipboard

Core providers: allow granular selection of implementation to use for each instance

Open misl6 opened this issue 1 year ago • 2 comments
trafficstars

"You don't need to worry about the implementation to use, Kivy will take care of it for you."

We already provide an environment variable to restrict the core providers (e.g. os.environ["KIVY_IMAGE"] = "imageio,sdl2"), but that applies to the whole app and not to a specific instance.

But, what if the user wants to specify an implementation to use as is more performant for that specific case, or maybe just have a preference?

Kivy should allow a granular selection of the implementation to use for each instance.

misl6 avatar Jan 20 '24 16:01 misl6

A use case example:

Consider two text providers:

  • sdl2
  • pil

The sdl2 provider is more efficient than the pil provider; however, the pil provider has some features that sdl2 does not.

Therefore, suppose an app uses 500 text widgets, and 50 of them require a feature that only exists in pil. Currently, there are only 3 alternatives:

  1. Use sdl2 without the feature required for the 50 widgets.
  2. Use pil to access the feature at the cost of lower performance for the other 450 widgets.
  3. Use an alternative solution to enable using pil for the 50 widgets that require the specific feature and keep sdl for the others for better performance.

In summary, this issue aims to allow this granular selection (as in option 3) natively, without the need for workarounds or hacks.

DexerBR avatar Jan 20 '24 20:01 DexerBR

Yes, that's a nice example!

misl6 avatar Jan 21 '24 09:01 misl6