A library is for coding in the classical sense. Declaring in YAML is a very light form of coding I would say, much more accessible to non-engineers. A simple dashboard in YAML is so much more readable to a human than some python code that uses a library. This is mainly a audience question.
If there's a use case in the future, we could consider also offering a library. But if you just want to vibe code dashboards in actual code, there's plenty out there already that will give you JS code (predominantly).