@johnsca brought this up. It would be nice if we could figure out same way of adding better support for tooling such as autocomplete to this library. get_interfaces() returns a dictionary that doesn't allow for any real introspection of what's in it.
The difficulty is that we're tied to agreeing on a schema version at runtime, which cuts our options down by a lot, possibly down to no real options. Using regular Python classes like charmcraft libs doesn't help, as we could end up in a situation like this:
from dataclasses import dataclass
@dataclass
class IngressV1Schema:
foo: str
@dataclass
class IngressV2Schema:
bar: str
If get_interfaces() has to decide at runtime which class will be used, static tooling that IDEs use won't be much help anyways. In fact they'll probably pick one or the other and provide wrong autocomplete options.
@johnsca brought this up. It would be nice if we could figure out same way of adding better support for tooling such as autocomplete to this library.
get_interfaces()returns a dictionary that doesn't allow for any real introspection of what's in it.The difficulty is that we're tied to agreeing on a schema version at runtime, which cuts our options down by a lot, possibly down to no real options. Using regular Python classes like charmcraft libs doesn't help, as we could end up in a situation like this:
If
get_interfaces()has to decide at runtime which class will be used, static tooling that IDEs use won't be much help anyways. In fact they'll probably pick one or the other and provide wrong autocomplete options.