Skip to content

gh-145351: use --no-install-recommends#145352

Draft
KowalskiThomas wants to merge 1 commit intopython:mainfrom
KowalskiThomas:kowalski/gh-145351-use-no-install-recommends
Draft

gh-145351: use --no-install-recommends#145352
KowalskiThomas wants to merge 1 commit intopython:mainfrom
KowalskiThomas:kowalski/gh-145351-use-no-install-recommends

Conversation

@KowalskiThomas
Copy link

@KowalskiThomas KowalskiThomas commented Feb 28, 2026

What is this PR?

Most details/context are available in gh-145351, but in short, local testing (through docker run) showed that not installing recommended packages for build dependencies brings install time from ~51s down to ~25, which definitely sounds worth doing.

Note As far as I know, GitHub Actions, for safety reasons, does not pick up changes from the PR's GHA configuration when there are some, and instead runs the version on the target branch, so I'm testing this change in my fork to validate that it works.
-> Result: I tested it in CI on my fork and the time in CI seems to be going down from 33s down to 21s, which is still worth it in my opinion.

@bedevere-app
Copy link

bedevere-app bot commented Feb 28, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@hugovk hugovk added skip news infra CI, GitHub Actions, buildbots, Dependabot, etc. labels Feb 28, 2026
@KowalskiThomas
Copy link
Author

KowalskiThomas commented Feb 28, 2026

I don't think the failing test is related to my changes 🤔 but I don't have the permissions needed to retry the job I believe.

ERROR: test_repl_eio (test.test_pyrepl.test_unix_console.TestUnixConsoleEIOHandling.test_repl_eio)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_pyrepl/test_unix_console.py", line 390, in test_repl_eio
    _, err = proc.communicate(timeout=support.LONG_TIMEOUT)
             ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/subprocess.py", line 1273, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
                     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/subprocess.py", line 2293, in _communicate
    self._check_timeout(endtime, orig_timeout, stdout, stderr)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/subprocess.py", line 1320, in _check_timeout
    raise TimeoutExpired(
    ...<2 lines>...
            stderr=b''.join(stderr_seq) if stderr_seq else None)
subprocess.TimeoutExpired: Command '['/home/runner/work/cpython/cpython-builddir/hypovenv/bin/python', '-E', '-S', '/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_pyrepl/eio_test_script.py']' timed out after 300.0 seconds

----------------------------------------------------------------------
Ran 246 tests in 308.647s

FAILED (errors=1, skipped=62)
test test_pyrepl failed
<sys>:0: ResourceWarning: unclosed file <_io.TextIOWrapper name=10 encoding='utf-8'>
<sys>:0: ResourceWarning: unclosed file <_io.TextIOWrapper name=7 encoding='utf-8'>

== Tests result: FAILURE ==

EDIT I just updated the branch (I don't like doing this since it means re-running everything in CI but I think some jobs depend on the failing one before starting, so if I want to check that everything is green I had to do it).

@KowalskiThomas KowalskiThomas force-pushed the kowalski/gh-145351-use-no-install-recommends branch from 86e078a to 804f172 Compare February 28, 2026 10:03
@webknjaz
Copy link
Member

@KowalskiThomas here's some different apt-related optimizations I'm doing elsewhere if you're interested in experimenting more: https://github.com/ansible/pylibssh/blob/7ee19d6bfce233bb453b4a48d1c805eb84743935/.github/workflows/reusable-tests.yml#L89-L118

@KowalskiThomas
Copy link
Author

here's some different apt-related optimizations

Thanks a lot, I'll give that a look and iterate in my fork + port it here if it helps!

@KowalskiThomas
Copy link
Author

KowalskiThomas commented Feb 28, 2026

So, based on the jobs than ran for this commit (job), it seems like the additional changes make the time for Install dependencies go down from 33s to 29s when not installing recommends.

I'll try without installing recommends.

Update the numbers seem a bit noisy to be honest. Maybe at this hour of day there's more noise or something, I'll try to run with the proposed additional optimisations locally and see if it helps here.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is worthwhile. It's a simple change, avoids installing stuff we don't need, so we need to be explicit in our dependencies.

Saving a bit of CI time is welcome, and may even prevent some occasional network timeouts (no need to download stuff we don't need).

Shall we also apply it to the others apt-get installs? Won't make so much difference there, but it's simple enough.

.github/workflows/regen-abidump.sh
5:apt-get install -yq abigail-tools python3

.github/workflows/reusable-ubuntu.yml
50:        sudo apt-get install bolt-19

.github/workflows/reusable-docs.yml
95:      run: sudo ./.github/workflows/posix-deps-apt.sh && sudo apt-get install wamerican

Let's not do KowalskiThomas@e886fd5 -- that's pretty complex and doesn't seem to save much time either.

@hugovk hugovk added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge infra CI, GitHub Actions, buildbots, Dependabot, etc. needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants