Python3 package includes 23 mb of precompiled files?
I am slightly surprised to find 23 MB worth of .pyc files included in Python 3.8 as packaged for Alpine 3.12;
$ docker run -it alpine:3.12
/ # export PYTHONDONTWRITEBYTECODE=1
/ # apk add python3
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/10) Installing libbz2 (1.0.8-r1)
(2/10) Installing expat (2.2.9-r1)
(3/10) Installing libffi (3.3-r2)
(4/10) Installing gdbm (1.13-r1)
(5/10) Installing xz-libs (5.2.5-r0)
(6/10) Installing ncurses-terminfo-base (6.2_p20200523-r0)
(7/10) Installing ncurses-libs (6.2_p20200523-r0)
(8/10) Installing readline (8.0.4-r0)
(9/10) Installing sqlite-libs (3.32.1-r0)
(10/10) Installing python3 (3.8.5-r0)
Executing busybox-1.31.1-r16.trigger
OK: 53 MiB in 24 packages
/ # du -csh $(find /usr/lib/python3.8 -name __pycache__)|grep M|sort -n
1.2M /usr/lib/python3.8/asyncio/__pycache__
1.2M /usr/lib/python3.8/pydoc_data/__pycache__
1.8M /usr/lib/python3.8/encodings/__pycache__
9.8M /usr/lib/python3.8/__pycache__
23.2M total
Also, the 2 variants seem to be present for every module (opt-1, opt-2). Is this intentional?
Is there a supported way to avoid them and let the interpreter compile what is really needed?