Bugzilla Automation <[email protected]> has asked freebsd-python (Nobody) <[email protected]> for maintainer-feedback: Bug 300806: lang/python3*: unconditionally install CPython's test modules, bloating packages by over half their installed size https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300806
--- Description --- lang/python312 (and likely python311/313/314/315 and their free-threaded variants python313t/python314t) currently install the entire CPython stdlib test suite unconditionally, with no way to opt out: - Lib/test/ and idlelib/idle_test/ (pure Python) - 10 C extension modules built specifically for the test suite: _testcapi, _testbuffer, _testclinic, _testimportmultiple, _testinternalcapi, _testmultiphase, _testsinglephase, _xxtestfuzz, _ctypes_test, xxsubtype On lang/python312 this is ~4900 of ~8000 pkg-plist entries (over 60%), and measured via pkg delete's "operation will free" size: 220 MiB installed with the test modules vs. 95 MiB without — i.e. ~125 MiB (57%) of the installed package is test-only content most users never touch. Upstream CPython's configure has supported --disable-test-modules since 3.10 (bpo-45416 / GH-28755) specifically so distributors can skip installing the test suite for end users. None of the lang/python3* ports pass this flag today. Proposed fix (implemented and verified for python312 so far): Add a new TEST port option (default off) that: - wires --enable-test-modules/--disable-test-modules via TEST_CONFIGURE_ENABLE=test-modules - gates the build-time self-test run (TEST_TARGET=buildbottest) behind the same option, so make test stays opt-in rather than always-on - tags the affected pkg-plist entries with %%TEST%% Verified on lang/python312 via poudriere: stage-qa/check-plist passes with TEST both on and off, and make test (TEST enabled) passes with only the usual expected flaky/skip failures CPython's own suite has on FreeBSD. Plan is to extend the same fix to python311, python313, python314, python315, and the free-threaded 313t/314t variants (which inherit most settings via MASTERDIR) once each is independently verified, since the exact set of gated .so modules may differ slightly per release. Patch for lang/python312 to follow as an attachment.
