Open
Description
Description
When pip installs a wheel with custom scripts that have a .py
extension, it creates corresponding .pyc
files. This pollutes the bin
directory, and doesn't accomplish anything, since I don't think Python loads .pyc
files for scripts.
Expected behavior
Now granted, the wheel spec does say:
Compile any installed .py to .pyc. (Uninstallers should be smart enough to remove .pyc even if it is not mentioned in RECORD.)
(emphasis mine)
But I think common sense suggests that only .py
files in the purelib and platlib directories should be compiled.
pip version
22.2.2
Python version
3.10.4
OS
Ubuntu 22.04
How to Reproduce
Install docutils
, then look in the bin
directory.
Output
$ python3 -mvenv ./venv
$ ./venv/bin/pip install -U pip
[...]
$ ./venv/bin/pip install docutils
Collecting docutils
Downloading docutils-0.19-py3-none-any.whl (570 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 570.5/570.5 kB 2.2 MB/s eta 0:00:00
Installing collected packages: docutils
Successfully installed docutils-0.19
$ ls ./venv/bin/__pycache__/
rst2html.cpython-310.pyc rst2latex.cpython-310.pyc rst2odt_prepstyles.cpython-310.pyc rst2xetex.cpython-310.pyc
rst2html4.cpython-310.pyc rst2man.cpython-310.pyc rst2pseudoxml.cpython-310.pyc rst2xml.cpython-310.pyc
rst2html5.cpython-310.pyc rst2odt.cpython-310.pyc rst2s5.cpython-310.pyc rstpep2html.cpython-310.pyc
Code of Conduct
- I agree to follow the PSF Code of Conduct.