Skip to content

Add show-config command to print resolved configuration#772

Open
MatthewMckee4 wants to merge 2 commits into
mainfrom
add-show-config
Open

Add show-config command to print resolved configuration#772
MatthewMckee4 wants to merge 2 commits into
mainfrom
add-show-config

Conversation

@MatthewMckee4
Copy link
Copy Markdown
Owner

Summary

Closes #763. Adds a karva show-config subcommand that resolves the same Settings the test runner builds — defaults layered with karva.toml/pyproject.toml and the selected profile — and prints them as TOML. This gives users a way to ask "what config is karva actually running with?" when debugging precedence between built-in defaults, [profile.default], a named profile, and CLI overrides.

The command takes the same --config-file and --profile/-P flags as karva test, so the resolution path matches what the runner would use. Output is a flat TOML body of the merged option groups (src, terminal, test, coverage) with every field populated to make defaults explicit.

karva show-config              # default profile
karva show-config --profile ci

The round-trip from resolved ProjectSettings back to Options lives on ProjectSettings::to_options() so there is a single source of truth (defaults still flow through to_settings). Runtime-only fields (filter, run_ignored, coverage disabled) are excluded since they don't come from configuration files, and fail_fast is omitted because max_fail is the canonical form. A future --source flag, as mentioned in the issue, would build on the same plumbing to annotate each value with its origin.

Test Plan

ci

@MatthewMckee4 MatthewMckee4 added cli Related to the command-line interface configuration Related to configuring Karva labels May 6, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 6, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 1 untouched benchmark


Comparing add-show-config (d125c10) with main (eb3c800)

Open in CodSpeed

Replace the manual `ProjectSettings::to_options()` round-trip with a
`Serialize` derive on each settings struct. Runtime-only fields
(`filter`, `run_ignored`) are skipped; `Duration` fields serialize as
fractional seconds; `MaxFail::unlimited()` is omitted via
`skip_serializing_if`. Adding a new setting now only requires extending
the canonical struct.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to the command-line interface configuration Related to configuring Karva

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add show-config command to print resolved configuration

1 participant