BSK-E0138
error
dataclass_transform metaclass violations
Detects type errors in classes whose metaclass is decorated with @dataclass_transform(...). Four violation kinds are covered:
1. **Frozen inheritance**: a non-frozen subclass inheriting from a frozen one. 2. **Frozen attribute assignment**: mutating an attribute of a frozen instance. 3. **Positional argument to kw-only constructor**: all fields are keyword-only when kw_only_default=True on the transform. 4. **Ordering comparison without order**: using </<=/>/>= on instances of a class that did not opt in to order=True.
from typing import dataclass_transform
@dataclass_transform(kw_only_default=True)
class ModelMeta(type): ...
class ModelBase(metaclass=ModelMeta): ...
class Customer(ModelBase, frozen=True):
id: int
c = Customer(id=1)
c.id = 2 # E — frozen
v = c < c # E — no ordering methods
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
BSK-E0138 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-E0138