Skip to content

Binary distributions such as wheels include C sources #646

@musicinmybrain

Description

@musicinmybrain

Describe the bug

Binary distributions such as wheels include C sources (_quoting_c.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 yarl
(_e) $ ls -l _e/lib64/python*/site-packages/yarl/

Expected behavior

These 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 yarl
(_e) $ ls -l _e/lib64/python*/site-packages/yarl/
total 1368
-rw-rw-r--. 1 ben ben    154 Dec  7 23:42 __init__.py
-rw-rw-r--. 1 ben ben   3703 Dec  7 23:42 __init__.pyi
drwxrwxr-x. 1 ben ben    190 Dec  7 23:42 __pycache__
-rw-rw-r--. 1 ben ben     13 Dec  7 23:42 py.typed
-rw-rw-r--. 1 ben ben 455467 Dec  7 23:42 _quoting_c.c
-rwxrwxr-x. 1 ben ben 861488 Dec  7 23:42 _quoting_c.cpython-310-aarch64-linux-gnu.so
-rw-rw-r--. 1 ben ben    447 Dec  7 23:42 _quoting_c.pyi
-rw-rw-r--. 1 ben ben  11498 Dec  7 23:42 _quoting_c.pyx
-rw-rw-r--. 1 ben ben    519 Dec  7 23:42 _quoting.py
-rw-rw-r--. 1 ben ben   6386 Dec  7 23:42 _quoting_py.py
-rw-rw-r--. 1 ben ben  36031 Dec  7 23:42 _url.py

Python Version

$ python --version
Python 3.10.0

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

Additional context

A suggested fix is to add to setup(…) in setup.py:

    exclude_package_data={"": ["*.c"]},

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions