Configuration

pydantic settings Config[source]

Project configuration.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

Show JSON schema
{
   "title": "Config",
   "description": "Project configuration.",
   "type": "object",
   "properties": {
      "base_path": {
         "description": "Directory the config was loaded from, used to resolve relative paths.",
         "format": "path",
         "title": "Base Path",
         "type": "string"
      },
      "root_sass_file": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Scss stylesheet with the style for the whole application.",
         "title": "Root Sass File"
      },
      "root_qss_file": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Qss stylesheet with the style for the whole application, generated from 'root_sass_file'.",
         "title": "Root Qss File"
      },
      "generator": {
         "allOf": [
            {
               "$ref": "#/$defs/CodeGenerators"
            }
         ],
         "default": "python",
         "description": "Code generator used to compile ui and resource files."
      },
      "flatten_folder_structure": {
         "default": true,
         "description": "Whether to keep the original folder structure or flatten it.",
         "title": "Flatten Folder Structure",
         "type": "boolean"
      },
      "ui_files_folder": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Root folder containing *.ui files.",
         "title": "Ui Files Folder"
      },
      "generated_ui_code_folder": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Root folder to save code generated from *.ui files to.",
         "title": "Generated Ui Code Folder"
      },
      "uic_args": {
         "description": "Additional arguments for the uic executable.",
         "items": {
            "type": "string"
         },
         "title": "Uic Args",
         "type": "array"
      },
      "form_import": {
         "default": true,
         "description": "Python: generate imports relative to '.'",
         "title": "Form Import",
         "type": "boolean"
      },
      "resource_folder": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Root folder containing *.qrc files.",
         "title": "Resource Folder"
      },
      "generated_rc_code_folder": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Root folder to save code generated from *.qrc files to.",
         "title": "Generated Rc Code Folder"
      },
      "rcc_args": {
         "description": "Additional arguments for the rcc executable.",
         "items": {
            "type": "string"
         },
         "title": "Rcc Args",
         "type": "array"
      }
   },
   "$defs": {
      "CodeGenerators": {
         "description": "Valid code generator values.",
         "enum": [
            "python",
            "cpp"
         ],
         "title": "CodeGenerators",
         "type": "string"
      }
   },
   "additionalProperties": false,
   "required": [
      "base_path"
   ]
}

Fields:
Validators:
  • _validate_rc_input_path » all fields

  • _validate_rc_io » all fields

  • _validate_style_input_path » all fields

  • _validate_styles_io » all fields

  • _validate_ui_input_path » all fields

  • _validate_ui_io » all fields

field base_path: Path [Required]

Directory the config was loaded from, used to resolve relative paths.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field flatten_folder_structure: bool = True

Whether to keep the original folder structure or flatten it.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field form_import: bool = True

Python: generate imports relative to ‘.’

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field generated_rc_code_folder: str | None = None

Root folder to save code generated from *.qrc files to.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field generated_ui_code_folder: str | None = None

Root folder to save code generated from *.ui files to.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field generator: CodeGenerators = CodeGenerators.python

Code generator used to compile ui and resource files.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field rcc_args: List[str] [Optional]

Additional arguments for the rcc executable.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field resource_folder: str | None = None

Root folder containing *.qrc files.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field root_qss_file: str | None = None

Qss stylesheet with the style for the whole application, generated from ‘root_sass_file’.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field root_sass_file: str | None = None

Scss stylesheet with the style for the whole application.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field ui_files_folder: str | None = None

Root folder containing *.ui files.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

field uic_args: List[str] [Optional]

Additional arguments for the uic executable.

Validated by:
  • _validate_rc_input_path

  • _validate_rc_io

  • _validate_style_input_path

  • _validate_styles_io

  • _validate_ui_input_path

  • _validate_ui_io

deactivate_resource_build() None[source]

Deactivate resource building with build_all_assets().

deactivate_style_build() None[source]

Deactivate style building with build_all_assets().

deactivate_ui_build() None[source]

Deactivate ui building with build_all_assets().

rc_folder_paths() Tuple[Path, Path][source]

Resolve paths to root style files.

Returns:

Paths to resource_folder and generated_rc_code_folder.

Return type:

Tuple[Path, Path]

rcc_kwargs() RccKwargs[source]

Extract keyword arguments to be used with compile_resource_file.

Returns:

Keyword arguments for compile_resource_file.

Return type:

RccKwargs

root_style_paths() Tuple[Path, Path][source]

Resolve paths to root style files.

Returns:

Paths to root_sass_file and root_qss_file.

Return type:

Tuple[Path, Path]

ui_folder_paths() Tuple[Path, Path][source]

Resolve paths to root style files.

Returns:

Paths to ui_files_folder and generated_ui_code_folder.

Return type:

Tuple[Path, Path]

uic_kwargs() UicKwargs[source]

Extract keyword arguments to be used with compile_ui_file.

Returns:

Keyword arguments for compile_ui_file.

Return type:

UicKwargs

update(update_dict: Dict[str, Any], filter_none: bool = True) None[source]

Update config values.

Parameters:
  • update_dict (Dict[str, Any]) – Dict containing updated values.

  • filter_none (bool) – Whether or not to filter None values before updating. Defaults to True