Currently we use vs-code to develop and having pydocs documentation helps a lot to understand the system overall, but the IDE is returning the documentation of the interface rather than the implementation class, I'm wondering if there is a way to allow the IDE to use the implmentation class documentation rather than the interface one.
To better explain my point we have few classes in our app as shown below:
BaseKMSProvider is a domain specific interface for any KMSProvider while AWSProvider is its implementation. We have a Service class that uses a BaseKMSProvider but we know the instance of that provider will be the AWSProvider and therefore want the documentation to come directly from the it.
T = TypeVar("T")
class BaseProvider(Generic[T]):
pass
class BaseKMSProvider(BaseProvider):
@abstract_method
def method_a(self):
"""domain specific documentation"""
pass
class AWSProvider(BaseKMSProvider):
def method_a(self):
"""provider specific documentation"""
pass
class Service:
provider: BaseKMSProvider[AWSProvider] = get_aws_provider()
def some_service_method(self):
self.provider.method_a()
Here is image of the IDE: VS-code popup
I tried using Protocols also, but could not manage to make it work.
Is there any way to make the provider specific documentation appear in the Service class?
If you hover over the
provideryou will see that the actual type of the propertyprovideris still theBaseKMSProviderclass.IntelliSense will display
provider specific documentationunless you modify it toAWSProvider.