You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
add configure option to control the groups of .pyc files to install #88263
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2021-05-10.07:42:30.095>labels= ['type-feature', 'build', '3.11']
title='add configure option to control the groups of .pyc files to install'updated_at=<Date2021-05-10.08:11:29.783>user='https://github.com/pxinwr'
Currently when building and installing Python out of source, unoptimized .pyc files and 2 types of optimized .pyc files(*.opt-1.pyc and *.opt-2.pyc) are all compiled out and installed. So to reduce package size and build and installation time, we should provide an option in configure to control the groups of .pyc files to install. For distribution case, normally only one type of .pyc files even none is needed.
Please hold off with PR until we have agreed if we want this feature request makes sense at all. Linux distributions typically provide all pyc variants. There are also better ways to shrink code size, e.g. deduplication or compression.
Nowadays, compileall has the multiple-use -O option:
-o OPT_LEVELS Optimization levels to run compilation with. Default is -1 which uses the optimization level
of the Python interpreter itself (see -O).
And the Makefile hardcodes -o 0 -o 1 -o 2. The fix would be to replace that with a new Makefile variable, like COMPILEALL_OPTLEVELS="-o 0 -o 1 -o 2". I don't think it needs to be a configure-time option.
Note that the Makefile can also pass options via the COMPILEALL_OPTS variable. This needs to be left alone; people who override it expect that it doesn't contain the -o options .
Activity
pxinwr commentedon May 10, 2021
Currently when building and installing Python out of source, unoptimized .pyc files and 2 types of optimized .pyc files(*.opt-1.pyc and *.opt-2.pyc) are all compiled out and installed. So to reduce package size and build and installation time, we should provide an option in configure to control the groups of .pyc files to install. For distribution case, normally only one type of .pyc files even none is needed.
pxinwr commentedon May 10, 2021
For the configure option name used in PR# 23930, change it to "--enable-pyc-groups" is better? What is your advice?
tiran commentedon May 10, 2021
Please hold off with PR until we have agreed if we want this feature request makes sense at all. Linux distributions typically provide all pyc variants. There are also better ways to shrink code size, e.g. deduplication or compression.
encukou commentedon Mar 28, 2024
Nowadays, compileall has the multiple-use
-Ooption:And the Makefile hardcodes
-o 0 -o 1 -o 2. The fix would be to replace that with a new Makefile variable, likeCOMPILEALL_OPTLEVELS="-o 0 -o 1 -o 2". I don't think it needs to be a configure-time option.Note that the Makefile can also pass options via the
COMPILEALL_OPTSvariable. This needs to be left alone; people who override it expect that it doesn't contain the-ooptions .