Skip to content

feat(config)!: Replace contextual CLI arguments with dotted assignments - #923

Merged
gfieni merged 5 commits into
masterfrom
feat/dot-notation-cli-config
Sep 4, 2026
Merged

feat(config)!: Replace contextual CLI arguments with dotted assignments#923
gfieni merged 5 commits into
masterfrom
feat/dot-notation-cli-config

Conversation

@gfieni

@gfieni gfieni commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

PR overview:

  • Replace contextual CLI arguments with repeatable -C/--set-config PATH=VALUE assignments.
  • Introduce schema-driven configuration for root properties, dynamic components, and fixed component settings.
  • Load JSON, environment, and CLI sources independently, then merge them with JSON < environment < CLI precedence.
  • Validate and cast the complete merged configuration once.
  • Generate CLI help from the registered configuration schemas. (colored output is supported)
  • Simplify and switch to generic actor generators and database factories.
  • Remove the legacy configuration validator, parser aliases, unused APIs, and dedicated exceptions.
  • Rename the powerapi.cli package to powerapi.config.

Example:

  python -m powerapi \
    -C input.sensor.type=socket \
    -C input.sensor.port=9080 \
    -C formula.smartwatts.learn-error-window-size=10

Existing JSON configuration structure, POWERAPI_* environment variables, and --config-file remain supported.

Breaking changes

  • Contextual CLI arguments are replaced by -C/--set-config PATH=VALUE.
  • Imports from powerapi.cli must use powerapi.config.
  • Configuration schema aliases are no longer supported.
  • The Kubernetes pre-processor type is now kubernetes instead of k8s.
  • ConfigValidator and legacy parser APIs and exceptions are removed.

Verify that CSV input convert missing-file errors into ConnectionFailed
exceptions.
Verify that JSON inputs convert missing-file errors into
ConnectionFailed exception.
Replace the contextual CLI parser with argparse and the repeatable
`-C/--set-config PATH=VALUE` option.

Introduce schemas for root properties, component groups and fixed
component settings. Load JSON files, environment variables and CLI
assignments independencly, merge them with CLI precedence, and validate
the resulting configuration once.

BREAKING CHANGE: Contextual componenet arguments are replaced by
explicit configuration assignments. Schema aliases, ConfigValidator, and
legacy parser APIs and exceptions are removed.
Make `Generator` and `DBActorGenerator` generic over their actor and
database factory types.

Centralize actor, database, report and processor factory resolution.
Remove unused registry removal methods, duplicate constants and custom
"alread-used" exceptions. Expand behavior-level generator coverage.
BREAKING CHANGE: Modules previously imported from `powerapi.cli` must
now be imported from `powerapi.config`.
@gfieni gfieni self-assigned this Sep 4, 2026
@gfieni
gfieni requested a review from a team as a code owner September 4, 2026 14:21
@gfieni gfieni added the enhancement New feature or request label Sep 4, 2026
@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
12 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.46164% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.91%. Comparing base (84e5ae7) to head (315e969).
⚠️ Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
src/powerapi/config/config_parser.py 98.60% 2 Missing ⚠️
src/powerapi/config/generator.py 98.96% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #923      +/-   ##
==========================================
+ Coverage   80.26%   82.91%   +2.64%     
==========================================
  Files          86       86              
  Lines        3167     2909     -258     
==========================================
- Hits         2542     2412     -130     
+ Misses        625      497     -128     
Files with missing lines Coverage Δ
src/powerapi/config/_utils.py 100.00% <100.00%> (ø)
src/powerapi/config/binding_manager.py 97.91% <ø> (ø)
src/powerapi/config/cli_parser.py 100.00% <100.00%> (ø)
src/powerapi/config/common_cli_parsing_manager.py 100.00% <100.00%> (ø)
src/powerapi/config/config_loader.py 100.00% <100.00%> (ø)
src/powerapi/config/parsing_manager.py 100.00% <100.00%> (ø)
src/powerapi/exception.py 92.10% <100.00%> (+8.48%) ⬆️
src/powerapi/config/config_parser.py 98.60% <98.60%> (ø)
src/powerapi/config/generator.py 98.96% <98.96%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gfieni
gfieni merged commit 8e0ca97 into master Sep 4, 2026
10 checks passed
@gfieni
gfieni deleted the feat/dot-notation-cli-config branch September 4, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant