reportAbstractUsage.md
April 8, 2026 · View on GitHub
Overview
reportAbstractUsage is a diagnostic in Pylance and Pyright that warns when you attempt to instantiate or use an abstract class or method that has not been fully implemented. This helps catch errors where required abstract methods are missing or not properly overridden in subclasses.
Representative Issues
- #7328: Ensure that any overridden method in a subclass calls the corresponding method in the parent class, if it exists and is abstract.
- #8017: Ensure a clean and properly installed version of pyright to avoid errors related to corrupted installations.
Examples
from abc import ABC, abstractmethod
class Animal(ABC):
@abstractmethod
def speak(self) -> str:
pass
# Error: Cannot instantiate abstract class "Animal"
a = Animal()
Fix — implement all abstract methods in a subclass:
class Dog(Animal):
def speak(self) -> str:
return "Woof!"
d = Dog() # OK
Common Fixes & Workarounds
- Implement all abstract methods in subclasses before instantiating the class.
- If overriding an abstract method, ensure the implementation is complete and does not call an unimplemented abstract method from the parent class.
- Check for typos or signature mismatches in method definitions.
- Review the Pyright configuration documentation for options to adjust or suppress this diagnostic if needed.
See Also
python.analysis.diagnosticSeverityOverrides— adjust or suppress this diagnosticpython.analysis.typeCheckingMode— controls which diagnostics are enabled by default