Add arkprof console-script entry point#260
Merged
Merged
Conversation
- 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.
arkprof CLI entry point via [project.scripts]
… any conflicts, rebuild/test, and push. Head branch: , base branch: .
arkprof CLI entry point via [project.scripts]arkprof console-script entry point
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
arkprofconsole-script entry pointExtract the
if __name__ == "__main__"block inprofiler.pyinto acallable
main(argv=None)function and register it as a[project.scripts]console entry point inpyproject.toml:After
pip install,arkprof --plan <file>invokes the profiler CLI.Changes:
python/ark/profiler.py: move argparse logic intomain(argv=None);accept optional argv for testability; strip whitespace in
--target_processor_groupsparsing;__main__guard delegates tomain().pyproject.toml: add[project.scripts]section.python/unittest/test_profiler.py: add 5 CLI/unit tests —--helpexit code, missing
--planexit code, full arg parsing, defaults,and whitespace handling in
--target_processor_groups. All tests usemocks (no GPU required).
Source: PR #241 (
arkprof.py).