Skip to content

[Experimental] PGM CLI implementation#1297

Draft
TonyXiang8787 wants to merge 1 commit into
mainfrom
feature/pgm-cli
Draft

[Experimental] PGM CLI implementation#1297
TonyXiang8787 wants to merge 1 commit into
mainfrom
feature/pgm-cli

Conversation

@TonyXiang8787

@TonyXiang8787 TonyXiang8787 commented Feb 2, 2026

Copy link
Copy Markdown
Member

This PR attempts to implement a PGM command line interface as native executable which links to the C-API. The executable can be invoked in Python as a Python shim.

Check list

  • CLI implementation
  • CLI test using C++ doctest
  • Python shim
  • Python simple test
  • Conda test in PGM CI
  • Documentation for user
  • Documentation in build guide
  • Local test per environment
    • Windows
    • Mac
    • Linux
  • Modify and test in conda feedstock

Local test guide

Test install

Run the following at any working folder

uv tool install git+https://github.com/PowerGridModel/power-grid-model.git@feature/pgm-cli
power-grid-model --help
power-grid-model --version
uv tool uninstall power-grid-model

Test editable

Checkout this branch, then do a round of build and test.

uv sync --reinstall
uv run pytest
uv run power-grid-model --help
uv run power-grid-model --version

@TonyXiang8787 TonyXiang8787 self-assigned this Feb 2, 2026
@TonyXiang8787 TonyXiang8787 added feature New feature or request do-not-merge This should not be merged labels Feb 2, 2026

@mgovers mgovers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't have time to do a full review but this is at least some input

Comment thread power_grid_model_c/power_grid_model_c/CMakeLists.txt Outdated
Comment thread power_grid_model_c/power_grid_model_cli/cli_options.cpp
Comment thread power_grid_model_c/power_grid_model_cli/main.cpp Outdated
Comment thread power_grid_model_c/CMakeLists.txt
Comment thread src/power_grid_model/_core/power_grid_model_c/run_pgm_cli.py
Comment thread src/power_grid_model/_core/power_grid_model_c/run_pgm_cli.py
Comment thread src/power_grid_model/_core/power_grid_model_c/run_pgm_cli.py
Comment thread CMakeLists.txt
@sonarqubecloud

sonarqubecloud Bot commented May 4, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
78.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
77.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud


def main():
exe_path = get_pgm_cli_path()
os.execv(str(exe_path), [str(exe_path), *sys.argv[1:]]) # noqa: S606
Signed-off-by: Tony Xiang <19280867+TonyXiang8787@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
77.8% Coverage on New Code (required ≥ 80%)
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge This should not be merged feature New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants