python / python/cpython

Env Variable to Auto-Name and Recognize __pycache__ As .__pycache__

Open
#121,980 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Feature or enhancement

Proposal:

Introduce a Bash environment variable (PYTHON_PYCACHE_HIDDEN) that, when set, automatically names and recognizes the __pycache__ directory as .__pycache__. This change aims to improve directory cleanliness by making the __pycache__ directory hidden by default, reducing visual clutter in project directories.

The __pycache__ directory, often clutters project directories. While necessary for Python's efficient execution, it can be an eyesore, especially in larger projects. Making this directory hidden by default would: improve directory readability, maintain compiled functionality, and introduce optional visibility.

Bottom line, __pycache__ directory enhances Python's execution efficiency by storing compiled bytecode, but its contents are rarely useful for regular viewing, cluttering project directories unnecessarily.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

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

The issue names no files, tests, or entry points. First locate CPython's handling of pycache directory naming and recognition, then identify how environment variables are processed. Done means an opt-in PYTHON_PYCACHE_HIDDEN setting consistently uses and recognizes .pycache without breaking compiled-bytecode behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.