Coverage for /builds/svesch/cikit/src/cikit/env/env_vars.py: 100%
5 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-10-09 14:17 +0000
« prev ^ index » next coverage.py v7.14.1, created at 2026-10-09 14:17 +0000
1# SPDX-License-Identifier: GPL-3.0-or-later
2"""Environment variable definitions for the env package.
4This module defines the concrete variable list used by the CI environment setup.
5The variables are expressed as EnvVar instances and may reference other variables
6via `${VAR}` template placeholders.
8The definitions are intentionally placed in a dedicated module so that:
9- common resolution logic stays reusable and testable
10- projects can swap or extend variable sets without touching core utilities
12Author:
13 Sven Schlender
14Date:
15 2026-02-18
16"""
18from pathlib import Path
20from cikit.project_meta import find_project_file
22from .common import EnvVar, current_python_version, find_project_root, read_project_name
25def get_env_vars() -> list:
26 """Return the list of supported CI environment variables.
28 The environment variable definitions are constructed on demand to avoid
29 side effects during module import. Some defaults, such as project metadata
30 lookup, may perform file system access when resolved.
32 Returns:
33 List of EnvVar definitions used by CiEnvironment.
34 """
35 return [
36 EnvVar("PROJECT_NAME", "Name of the current project.", read_project_name),
38 EnvVar("PROJECT_FILE", "Path to the project file.", find_project_file, value_type=Path),
40 EnvVar("PYTHON_VERSION", "Resolved Python runtime version.", current_python_version),
42 EnvVar("EXEC_TOOL", "Command prefix used to execute project tools.", "uv run"),
44 EnvVar("PROJECT_ROOT", "Base directory of project.", find_project_root, value_type=Path),
46 EnvVar("PUBLIC_DIR", "Base directory for all generated CI artifacts.",
47 "${PROJECT_ROOT}/public", value_type=Path),
49 EnvVar("CIKIT_DATA_DIR", "Directory where cikit data cache is stored.",
50 "${PUBLIC_DIR}/cikit_data", value_type=Path),
52 EnvVar("CIKIT_DATA_BASE_URL", "Base URL of the remote cikit data service.", secret=True),
54 EnvVar("CIKIT_DATA_API_TOKEN", "Authentication token for the cikit data service.",
55 secret=True),
56 ]