BSK-E0137 error

Generic protocol violations

Detects violations related to generic protocol usage:

1. **ProtocolT combined with GenericT**: The ProtocolT, S, ... shorthand is already equivalent to Protocol, GenericT, S, .... It is an error to combine the shorthand with an explicit Generic... base.

2. **Incompatible generic protocol assignment**: When a module-level variable is annotated with a concrete generic protocol specialisation like Protoint, str and the RHS is a concrete class, the concrete class's method signatures must be compatible with the substituted type arguments.

3. **Self-typed protocol method incompatibility**: When a protocol declares methods using a self: T annotation (making the return type depend on the concrete receiver), concrete classes that implement those methods with incompatible signatures are flagged.

from typing import Generic, Protocol, TypeVar

T_co = TypeVar("T_co", covariant=True)

class Proto2(Protocol[T_co], Generic[T_co]):  # E — shorthand + Generic
    ...

PEP 544: <https://typing.readthedocs.io/en/latest/spec/protocol.html#generic-protocols>

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial BSK-E0137 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/BSK-E0137