PY-CLAS0001 · explicit_registry_name
Detect registry classes that override their derivable class key.
This is a deterministic rule for python. Read its implementation.
Definition
Section titled “Definition”A class whose direct base is Registry, Strategy, Backend, Provider, or
Component should use the registry key derived from its class name. A class-level
string assignment to name duplicates identity and can drift from the class. The shared
project normalizer derives the snake-case key with inflection.underscore.
Evidence
Section titled “Evidence”Every finding identifies the explicit class-level name assignment and shows the
snake-case key that the project derives from the class name.
Exceptions
Section titled “Exceptions”Keep an override only when a documented external protocol requires a different stable wire key.
The exception should be explicit because removing it can change configuration. registry_bases
names the bases whose subclasses derive their key from the class name, so a project with its
own registry foundation states it rather than accepting these five.
Examples
Section titled “Examples”class JsonBackend(Backend): name = "json_backend" returns true, because the registry
already derives json_backend from the class name. class JsonBackend(Backend) with no name
assignment returns false. class JsonBackend(Backend): name = "application/json" also
returns true and needs an external wire-protocol justification to keep.
References
Section titled “References”- Cites “patos documentation”,
Registryauto-derived class names - Cites “Inflection documentation”, underscore. Open reference