$ cat include/Make/Python.make
PY_SOURCES := $(wildcard *.py)
%.pyc: %.py
$(PYTHON) -t -m py_compile $<
The make command explicitly compiles the *.py files to *.pyc and copies them to the dist directory. I haven’t tested the packaging code but I guess that they might get included in the packages too.
Just for the record, on linux x64 + Python 3:
du -ch ./dist.x86_64-pc-linux-gnu | tail -n1
93M ./
$ find ./dist.x86_64-pc-linux-gnu -name *.pyc -exec du -ch {} + | tail -n1
6.6M total
$ find ./dist.x86_64-pc-linux-gnu -name *.py -exec du -ch {} + | tail -n1
9.7M total
Is there a reason why this is happening? AFAIK distributing just the *.py files is usually enough since *.pyc files get created on first import (if the user has write permissions; for more info here)
The other downside, and the real reason I looked into this, is that on my laptop I need ~5 secs to run make on lib/python (on Python 3; Python 2 is faster). Not too big, but big enough for an interpreted language like Python. And smaller compilation times help you get into and stay in the flow
PS. Not a real biggie, but I am just curious.