Skip to content

Resolve config-relative paths from the config file directory#1502

Closed
biefan wants to merge 1 commit intomicrosoft:mainfrom
biefan:resolve-config-relative-paths-from-config-dir
Closed

Resolve config-relative paths from the config file directory#1502
biefan wants to merge 1 commit intomicrosoft:mainfrom
biefan:resolve-config-relative-paths-from-config-dir

Conversation

@biefan
Copy link
Copy Markdown
Contributor

@biefan biefan commented Mar 17, 2026

Summary

  • resolve relative initialization_scripts and env_files from the configuration file directory when loading YAML config files
  • preserve the existing current-working-directory behavior for CLI path overrides
  • add regression tests for both from_yaml_file() and load_with_overrides(config_file=...)

Problem

ConfigurationLoader currently resolves relative initialization_scripts and env_files from the caller's working directory. When a config file lives in another directory, values like ./scripts/init.py or ./env/local.env point to the wrong files.

Validation

  • .venv/bin/pytest tests/unit/setup -q
  • .venv/bin/ruff check pyrit/setup/configuration_loader.py tests/unit/setup/test_configuration_loader.py

@romanlutz
Copy link
Copy Markdown
Contributor

Thanks for identifying the real bug. Relative paths resolving from cwd instead of the config file directory is worth fixing. However, this can be solved much more simply by eagerly resolving relative paths to absolute at YAML load time (in from_yaml_file), which avoids the new hidden state fields and plumbing through load_with_overrides. The initializer construction change should also be a separate PR.

I'm submitting a separate PR #1650 since it's a significant amount of change from this PR.

@romanlutz romanlutz closed this Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants