Fix ModuleNotFoundError for tritonparse CLI Entry Point #154
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.
Problem
After installing the package via
pip install
, runningtritonparse --help
resulted in the following error:Root Cause: The
pyproject.toml
entry point was configured astritonparseoss = "tritonparse.run:main"
, but therun.py
file was located at the project root instead of inside thetritonparse/
package directory.Solution
Restructured the CLI entry point to follow standard Python package conventions:
tritonparse/cli.py
: Moved the complete CLI implementation into the package directoryrun.py
: Converted it into a lightweight wrapper that imports fromtritonparse.cli
tritonparse.run
totritonparse.cli
in both__main__.py
andpyproject.toml
This approach:
ModuleNotFoundError
after installationrun.py
still works)cli.py
explicitly indicates command-line interface)Changes
New Files
tritonparse/cli.py
: Complete CLI implementation with argparse setup and command handlersModified Files
run.py
: Simplified to a wrapper that imports and callsmain()
fromtritonparse.cli
tritonparse/__main__.py
: Updated import from.run
to.cli
pyproject.toml
: Changed entry point fromtritonparse.run:main
totritonparse.cli:main
Testing
All three entry points now work correctly:
Impact
tritonparseoss
command after installationrun.py
continues to work for local developmenttritonparse/cli.py