Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: exclude __pycache__ directories from wheels (#31397)#31402

Merged
charris merged 1 commit into
numpy:maintenance/2.4.xfrom
charris:backport-31397
May 8, 2026
Merged

BUG: exclude __pycache__ directories from wheels (#31397)#31402
charris merged 1 commit into
numpy:maintenance/2.4.xfrom
charris:backport-31397

Conversation

@charris
Copy link
Copy Markdown
Member

@charris charris commented May 8, 2026

Backport of #31397.

Summary

Closes #31392

This updates the Meson install rules to exclude __pycache__ directories from wheel contents
Issue was reported for wheels containing bytecode cache files such as:

numpy/distutils/__pycache__/conv_template.cpython-311.pyc

__pycache__ directories are generated locally during Python execution/compilation and should not be copied into built wheels.

Validation

Created a local __pycache__ directory under an installed pure Python subdirectory:

python -c "import py_compile; py_compile.compile('numpy/f2py/__init__.py')"
find numpy/f2py -name "__pycache__" -o -name "*.pyc"

Built the wheel:

python -m build -w

Confirmed no __pycache__ entries were included:

unzip -l dist/*.whl | grep __pycache__
unzip -l dist/*.whl | grep "numpy/f2py/__pycache__"

Both grep commands returned no output

AI was used to help draft the PR description and to sanity check local verification steps. The code change was made and tested locally by me.

@charris charris added this to the 2.4.5 release milestone May 8, 2026
@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs labels May 8, 2026
@charris charris merged commit 626d469 into numpy:maintenance/2.4.x May 8, 2026
72 of 73 checks passed
@charris charris deleted the backport-31397 branch May 8, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00 - Bug 08 - Backport Used to tag backport PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants