ModelConfig#

class pisces.models.core.utils.ModelConfig[source]#

Descriptor for accessing the registered configuration of a model class.

This descriptor provides dynamic, read-only access to the model’s configuration as stored in the global pisces_config registry. It is intended to be used as a class-level attribute within model classes.

Usage#

Define a config attribute using this descriptor:

class MyModel(BaseModel):
    config = ModelConfig()

Then access it via the class or an instance:

MyModel.config  # Access class-level configuration
my_model.config  # Also works via instance

The corresponding entry in the configuration registry should be:

models:
  MyModel:
    param1: ...
    param2: ...
raises AttributeError:

If the configuration entry for the model class is missing.

returns:

A dictionary of configuration options for the model.

rtype:

dict

Methods