protocols_explicit error

Direct instantiation of a Protocol class

Protocol classes define structural interfaces and cannot be instantiated directly. Only concrete classes that satisfy the protocol may be instantiated.

from typing import Protocol

class MyProto(Protocol):
    def method(self) -> int: ...

obj = MyProto()  # E — cannot instantiate a Protocol

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial protocols_explicit down per-file or per-path from your editor or pyproject.toml, or fix the code so it type-checks. See the Type System rules and the complete diagnostic reference.

Canonical URL: https://www.basilisk-python.dev/errors/protocols_explicit