craft_parts.state_manager.build_state module

State definitions for the build step.

class craft_parts.state_manager.build_state.BuildState(**data)[source]

Bases: StepState

Context information for the build step.

Parameters:

data (Any)

assets: dict[str, Any]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function StepState.<lambda>>, 'extra': 'ignore', 'frozen': True, 'populate_by_name': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'assets': FieldInfo(annotation=dict[str, Any], required=False, default={}, alias='assets', alias_priority=1), 'directories': FieldInfo(annotation=set[str], required=False, default=set(), alias='directories', alias_priority=1), 'files': FieldInfo(annotation=set[str], required=False, default=set(), alias='files', alias_priority=1), 'overlay_hash': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, alias='overlay-hash', alias_priority=1, metadata=[BeforeValidator(func=<function validate_hex_string>, json_schema_input_type=PydanticUndefined)]), 'part_properties': FieldInfo(annotation=dict[str, Any], required=False, default={}, alias='part-properties', alias_priority=1), 'project_options': FieldInfo(annotation=dict[str, Any], required=False, default={}, alias='project-options', alias_priority=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

overlay_hash: Annotated[str | None]
project_options_of_interest(project_options)[source]

Return relevant project options concerning this step.

Parameters:

project_options (dict[str, Any]) – A dictionary containing all project options.

Return type:

dict[str, Any]

Returns:

A dictionary containing project options of interest.

properties_of_interest(part_properties, *, extra_properties=None)[source]

Return relevant properties concerning this step.

Parameters:
  • part_properties (dict[str, Any]) – A dictionary containing all part properties.

  • extra_properties (Optional[list[str]]) – Additional relevant properties to return.

Return type:

dict[str, Any]

Returns:

A dictionary containing properties of interest.

classmethod unmarshal(data)[source]

Create and populate a new BuildState object from dictionary data.

The unmarshal method validates entries in the input dictionary, populating the corresponding fields in the state object.

Parameters:

data (dict[str, Any]) – The dictionary data to unmarshal.

Return type:

BuildState

Returns:

The newly created object.

Raises:

TypeError – If data is not a dictionary.