BaseConfig

class BaseConfig(*, project_name: str, root_path: Path, python_versions: tuple[Annotated[str, AfterValidator(func=valid_version_string)], ...] = ('3.10', '3.11', '3.12', '3.13', '3.14'), exasol_versions: tuple[Annotated[str, AfterValidator(func=valid_version_string)], ...] = ('7.1.30', '8.29.13', '2025.1.8'), create_major_version_tags: bool = False, add_to_excluded_python_paths: tuple[str | Path, ...] = (), plugins_for_nox_sessions: tuple[Annotated[type[Any], AfterValidator(func=validate_plugin_hook)], ...] = (), dependency_manager: DependencyManager = DependencyManager(name='poetry', version='2.3.0'), os_version: Annotated[str, _PydanticGeneralMetadata(pattern='^ubuntu-.*')] = 'ubuntu-24.04')[source]

Bases: BaseModel

Basic configuration for projects using the PTB

This configuration class defines the necessary attributes for using the PTB’s various nox sessions and GitHub CI workflows. Defaults are provided via the attributes, which makes it easy for a specific project to modify these values as needed. There are properties provided which automate some configuration aspects so that the project-specific modifications are reduced.

pydantic has been used so that altered attributes are quickly validated. This allows for immediate feedback, instead of waiting for various failed CI runs.

project_name: str
root_path: Path
python_versions: tuple[Annotated[str, AfterValidator(func=valid_version_string)], ...]
exasol_versions: tuple[Annotated[str, AfterValidator(func=valid_version_string)], ...]
create_major_version_tags: bool
add_to_excluded_python_paths: tuple[str | Path, ...]

Extends the default set of paths to be ignored by the PTB, defined in DEFAULT_EXCLUDED_PATHS.

plugins_for_nox_sessions: tuple[Annotated[type[Any], AfterValidator(func=validate_plugin_hook)], ...]
dependency_manager: DependencyManager
os_version: str
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'frozen': True}

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

property documentation_path: Path

Path where the documentation for the project is stored.

property minimum_python_version: str

Minimum Python version declared from the python_versions list

This is used in specific testing scenarios where it would be either costly to run the tests for all python_versions or we need a single metric.

property excluded_python_paths: tuple[Path, ...]

For nox sessions as listed below, this property defines which paths to ignore below PROJECT_CONFIG.root_path. By default ignores the paths in DEFAULT_EXCLUDED_PATHS, incl. dist and .eggs. Additional paths can be configured with BaseConfig.add_to_excluded_python_paths().

Affected nox sessions:
  • format:check

  • format:fix

  • lint:code

  • lint:security

  • lint:typing

property pyupgrade_argument: tuple[str, ...]

Default argument to exasol.toolbox._format._pyupgrade().

It uses the minimum Python version to ensure compatibility with all supported versions of a project.

property sonar_code_path: Path

Relative path needed in Nox session sonar:check to create the coverage XML.

property source_code_path: Path

Path to the source code of the project.

property version_filepath: Path

Path to the version.py file included in the project. This is an autogenerated file which contains the version of the code. It is maintained by the nox sessions version:check and release:prepare.

property github_workflow_directory: Path

Path to the GitHub workflow directory.

property github_template_dict: dict[str, Any]

Dictionary of variables to dynamically render Jinja2 templates into valid YAML configurations.

property github_workflow_patcher_yaml: Path | None

For customizing the GitHub workflow templates provided by the PTB, a project can define a .workflow-patcher.yml file containing instructions to delete or modify jobs in the PTB template. Modification includes replacing and inserting steps.