Skip to content

Add arkprof console-script entry point#260

Merged
chhwang merged 6 commits into
mainfrom
pr-j-arkprof
Jun 12, 2026
Merged

Add arkprof console-script entry point#260
chhwang merged 6 commits into
mainfrom
pr-j-arkprof

Conversation

@chhwang

@chhwang chhwang commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Add arkprof console-script entry point

Extract the if __name__ == "__main__" block in profiler.py into a
callable main(argv=None) function and register it as a
[project.scripts] console entry point in pyproject.toml:

arkprof = "ark.profiler:main"

After pip install, arkprof --plan <file> invokes the profiler CLI.

Changes:

  • python/ark/profiler.py: move argparse logic into main(argv=None);
    accept optional argv for testability; strip whitespace in
    --target_processor_groups parsing; __main__ guard delegates to
    main().
  • pyproject.toml: add [project.scripts] section.
  • python/unittest/test_profiler.py: add 5 CLI/unit tests — --help
    exit code, missing --plan exit code, full arg parsing, defaults,
    and whitespace handling in --target_processor_groups. All tests use
    mocks (no GPU required).

Source: PR #241 (arkprof.py).

chhwang and others added 2 commits June 11, 2026 14:01
- Refactor profiler.py __main__ block into def main().
- Add [project.scripts] arkprof = "ark.profiler:main" to pyproject.toml.
- Add test_profiler_cli_help and test_profiler_cli_missing_plan to
  test_profiler.py (pure-subprocess, no GPU needed).
… against main. Commit (profiler.py main() extraction, pyproject.toml console script, CLI tests in test_profiler.py) exists locally. Previous dev+local-test passed; verify failed on deep-review infra, not code. Skip deep-review; push and open PR.
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.70%. Comparing base (02dcf84) to head (3be32d8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #260      +/-   ##
==========================================
+ Coverage   85.48%   85.70%   +0.21%     
==========================================
  Files         129      129              
  Lines        6457     6457              
==========================================
+ Hits         5520     5534      +14     
+ Misses        937      923      -14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

chhwang added 2 commits June 11, 2026 15:02
Two new tests (test_profiler_main_arg_parsing, test_profiler_main_defaults)
exercise every line of main() by mocking Plan.from_file and Profiler,
covering the arg-parsing and delegation logic without GPU.
- Reformat with-patch statements in test_profiler.py to match black.
- Add '# pragma: no cover' to the if __name__ guard in profiler.py;
  this block is genuinely uninstrumentable by pytest-cov because
  the module is always imported, never run as __main__ in-process.
@chhwang chhwang changed the title ark-dev: Continue P11: push branch pr-j-arkprof to origin and open PR against main. Commit (profiler.py main() extraction, pyproject.toml console script, CLI tests in test_profiler.py) exists locally. Previous dev+local-test passed; verify failed on deep-review infra, not code. Skip deep-review; push and open PR. Add arkprof CLI entry point via [project.scripts] Jun 11, 2026
chhwang and others added 2 commits June 12, 2026 00:30
… any conflicts, rebuild/test, and push. Head branch: , base branch: .
@chhwang chhwang changed the title Add arkprof CLI entry point via [project.scripts] Add arkprof console-script entry point Jun 12, 2026
@chhwang chhwang merged commit 5e84b1e into main Jun 12, 2026
10 of 11 checks passed
@chhwang chhwang deleted the pr-j-arkprof branch June 12, 2026 01:35
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.

1 participant