python / python/cpython

Suggest the possible module in "python -m module"

Open
#145,031 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib topic-importlib type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

Proposal:

Now python has suggested the possible module name when ModuleNotFoundError raised. This issue is trying to make it also enable in "python -m module". The effect is like:

❯ python -m randon
/Library/Frameworks/Python.framework/Versions/3.14/bin/python3: No module named 'randon'. Did you mean: 'random'?

Changing "runpy.py" can make it.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-145096

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with runpy.py and reproduce the reported python -m randon command to inspect the current ModuleNotFoundError output. Review linked PR gh-145096 before making changes; done means module execution suggests the likely module name in the error message.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.