microsoft / debugpy

An implementation of the Debug Adapter Protocol for Python
https://pypi.org/project/debugpy/
Other
1.73k stars 127 forks source link

Smaller pure Python wheel #1394

Open brettcannon opened 9 months ago

brettcannon commented 9 months ago

https://pypi.org/project/debugpy/1.8.0/#files shows that the pure Python wheel is one of the biggest wheel files available. That seems counterintuitive as you would assume the addition of compiled code in the other wheels would push those over the top instead of being smaller. Are some files being stripped out of the binary wheels that are left in the pure Python wheel for compatibility or something?

int19h commented 9 months ago

Pure Python wheel contains .dll & .so files that are injected into the target process for attach to PID purposes covering all three major supported platforms. As those aren't Python modules and aren't required for any other debugpy functionality, they don't affect the tagging of the wheel.

OTOH platform-specific wheels only contain injected .dll / .so for the target platform (although on Windows we include both 32-bit and 64-bit versions regardless of the bitness of the wheel itself).

The intent is that if the user does pip install debugpy, they should be able to do debugpy --pid ... on any supported platform, regardless of which wheel was actually installed.

I wonder if perhaps we should make attach-to-PID binaries a separate wheel.

brettcannon commented 9 months ago

they don't affect the tagging of the wheel.

It isn't the tagging so much as the binary size.

I wonder if perhaps we should make attach-to-PID binaries a separate wheel.

You wouldn't be able to put it on PyPI as there isn't a way to upload a wheel that differs only by some files inside of it while keeping the targeted platform the same. Typically for this you would release an ancillary package that people could include via an extra like debugpy[attach-to-pid] in order to get the extra files installed.