Binary distributions such as wheels include C sources #6399
Description
Describe the bug
Binary distributions such as wheels include C sources (_find_header.c, _find_header.h, _helpers.c, _http_parser.c, _http_writer.c, and _websocket.c), but these sources don’t provide value in binary distributions and their size is significant.
See also aio-libs/frozenlist#250.
To Reproduce
$ python3 -m venv _e
$ . _e/bin/activate
(_e) $ pip install aiohttp
(_e) $ ls -l _e/lib64/python*/site-packages/aiohttp/*.{c,h,pyx,px*}
Expected behavior
The C sources should ideally be present in the sdist but not in the bdist, where they don’t really provide any value.
Logs/tracebacks
$ python3 -m venv _e
$ . _e/bin/activate
(_e) $ pip install aiohttp
(_e) $ ls -l _e/lib64/python*/site-packages/aiohttp/*.{c,h,pyx,px*}
-rw-rw-r--. 1 ben ben 4998 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_cparser.pxd
-rw-rw-r--. 1 ben ben 187570 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_find_header.c
-rw-rw-r--. 1 ben ben 170 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_find_header.h
-rw-rw-r--. 1 ben ben 68 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_find_header.pxd
-rw-rw-r--. 1 ben ben 2007 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_headers.pxi
-rw-rw-r--. 1 ben ben 212982 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_helpers.c
-rw-rw-r--. 1 ben ben 1049 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_helpers.pyx
-rw-rw-r--. 1 ben ben 978187 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_http_parser.c
-rw-rw-r--. 1 ben ben 26571 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_http_parser.pyx
-rw-rw-r--. 1 ben ben 221270 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_http_writer.c
-rw-rw-r--. 1 ben ben 4575 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_http_writer.pyx
-rw-rw-r--. 1 ben ben 138420 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_websocket.c
-rw-rw-r--. 1 ben ben 1561 Dec 7 23:42 _e/lib64/python3.10/site-packages/aiohttp/_websocket.pyxPython Version
$ python --version
Python 3.10.0aiohttp Version
$ python -m pip show aiohttp
Name: aiohttp
Version: 3.8.1
[…]multidict Version
$ python -m pip show multidict
Name: multidict
Version: 5.2.0
[…]yarl Version
$ python -m pip show yarl
Name: yarl
Version: 1.7.2
[…]OS
Fedora Linux 35—but this issue is platform-independent
Related component
Server
Additional context
A suggested fix is to add to setup(…) in setup.py:
exclude_package_data={"": ["*.c", "*.h"]},which will exclude these sources from binary distributions without affecting source distributions.
It’s possible to exclude some of the Cython files as well, but in frozenlist the preference was to keep them in the bdist for debugging purposes.
PR to follow.
Code of Conduct
- I agree to follow the aio-libs Code of Conduct