Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary distributions such as wheels include C sources #659

Closed
musicinmybrain opened this issue Dec 8, 2021 · 0 comments · Fixed by #660
Closed

Binary distributions such as wheels include C sources #659

musicinmybrain opened this issue Dec 8, 2021 · 0 comments · Fixed by #660

Comments

@musicinmybrain
Copy link
Contributor

Long story short

Binary distributions such as wheels include C sources (_multidict.c and _multilib/*.h) that aren’t obviously useful in this type of distribution.

See also aio-libs/frozenlist#250.

Expected behaviour

These should ideally be present in the sdist but not in the bdist.

Their total size is only about 100kB, but that’s 100kB that could easily be saved. In frozenlist, yarl, and aiohttp, the C sources are much larger since they are Cython-generated.

Actual behaviour

These files are included in both binary and source distributions.

Steps to reproduce

$ python3 -m venv _e
$ . _e/bin/activate
(_e) $ pip install multidict
(_e) $ ls -l _e/lib64/python*/site-packages/multidict/total 436
-rw-rw-r--. 1 ben ben   1190 Dec  7 23:42 _abc.py
-rw-rw-r--. 1 ben ben    363 Dec  7 23:42 _compat.py
-rw-rw-r--. 1 ben ben    942 Dec  7 23:42 __init__.py
-rw-rw-r--. 1 ben ben   4931 Dec  7 23:42 __init__.pyi
-rw-rw-r--. 1 ben ben   3791 Dec  7 23:42 _multidict_base.py
-rw-rw-r--. 1 ben ben  40881 Dec  7 23:42 _multidict.c
-rwxrwxr-x. 1 ben ben 358592 Dec  7 23:42 _multidict.cpython-310-aarch64-linux-gnu.so
-rw-rw-r--. 1 ben ben  14731 Dec  7 23:42 _multidict_py.py
drwxrwxr-x. 1 ben ben     84 Dec  7 23:42 _multilib
drwxrwxr-x. 1 ben ben    254 Dec  7 23:42 __pycache__
-rw-rw-r--. 1 ben ben     15 Dec  7 23:42 py.typed

Your environment

This is totally independent of platform.

Suggested fix

Add to setup(…) in setup.py:

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

which will exclude these sources from binary distributions without affecting source distributions.

PR to follow.

musicinmybrain added a commit to musicinmybrain/multidict that referenced this issue Dec 8, 2021
This does not affect source distributions.

Fixes aio-libs#659.
musicinmybrain added a commit to musicinmybrain/multidict that referenced this issue Dec 8, 2021
This does not affect source distributions.

Fixes aio-libs#659.
asvetlov pushed a commit that referenced this issue Dec 11, 2021
This does not affect source distributions.

Fixes #659.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant