GeezerVison is showing github.com — No way to disable bytecode compilation when installing cpython · Issue #160835 · python/cpython
No way to disable bytecode compilation when installing cpython #160835DescriptionBug report
When building and installing cpython it can be preferable to have more control over when compileall is executed. It would be useful if there was a way to disable the compilation in the libinstall target for people who want to control the compilation without doing it twice.
(Happy to send a patch if this isn't rejected out of hand)
CPython versions tested on:
3.14
Operating systems tested on:
Linux Activitypicnixz commented on Oct 28, 2026 What is the use case explicitly? is it a theoretical feature or is there a real need from redistributors? rossburton commented on Oct 28, 2026 ContributorAuthor More actions The specific use case is that we're packaging the standard library in more than one package so the easy way to handle this is to split the packaging up and then compile the py, because then the pyc goes into the right package without needing more work. picnixz commented on Oct 30, 2026 I have no strong opinion here but not compiling bytecode may be relevant. cc @encukou encukou commented on Oct 30, 2026 Maybe we can turn this into a compileall.py improvement?
IMO, the invocation should be make install COMPILEALL_OPTS='--no-recursion --skip=.*', which would be possible with two patches:
- allow multiple
-x options, so Makefile's -x badsyntax doesn't overwrite COMPILEALL_OPTS
- add long option aliases for readibility:
--skip for -x, --[no-]recursion to -l; perhaps more.
rossburton commented on Oct 30, 2026 ContributorAuthor More actions I have a patch to add long options for clarity.
The public API such as compileall.compile_dir exposes a single rx regex, so this can't be just changed to a list.
However, the argument parser could allow multiple skips and construct a new regex. So something like python3 -mcompileall -x foo -x bar ... would result in rx = r"foo|bar". If this is acceptable I can post it. encukou commented on Nov 2, 2026 That sounds good. The CLI docs should mention that as an .. impl-detail:: -- multiple values are joined with | which means you can do -x '(a' -x b)c to get (a|b)c, but a future Python version could reject such partial regexes. rossburton commented on Nov 11, 2026 ContributorAuthor More actions
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|