python / python/cpython

Explain what a source module is

Open
#93,378 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.10 3.11 3.12 docs
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Documentation

In the 6th tutorial chapter about Modules, the term "source module" is used.

Python does not check the cache in two circumstances. First, it always recompiles and does not store the result for the module that’s loaded directly from the command line. Second, it does not check the cache if there is no source module. To support a non-source (compiled only) distribution, the compiled module must be in the source directory, and there must not be a source module.

It isn't really specified what a "source module" is exactly. I think the original python script/module and not the compiled pyc file(s) is meant but I also think this isn't really obvious here (although a hint is given by the phrase "To support a non-source (compiled only)" in the next sentence). My initial suggestion:

Python does not check the cache in two circumstances. First, it always recompiles and does not store the result for the module that’s loaded directly from the command line. Second, it does not check the cache if there is no source module, which refers to the non-compiled python script or module. To support a non-source (compiled only) distribution, the compiled module must be in the source directory, and there must not be a source module.

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

Open the linked Modules chapter in the Python tutorial and locate the paragraph describing when the bytecode cache is checked. Clarify what “source module” means in that paragraph, then verify that the revised wording remains consistent with the surrounding explanation of source and compiled-only distributions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.