dataclasses_kwonly error

Dataclass constructor argument violations

Reports errors when: - A positional argument is passed to a keyword-only dataclass field - A keyword argument targets a field with init=False (not part of __init__)

from dataclasses import dataclass, KW_ONLY

@dataclass
class Point:
    x: float
    _: KW_ONLY
    y: float = 0.0

Point(1.0)       # OK — x positional, y uses default
Point(1.0, 2.0)  # E — y is keyword-only, cannot be passed positionally

How to handle it

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