Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build a wheel once, for all test environments #308

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

kurtmckee
Copy link
Contributor

@kurtmckee kurtmckee commented Jun 27, 2024

The test suite currently builds a .tar.gz file, but when it's installed in each tox environment, pip converts the .tar.gz file to a wheel and then installs it.

This PR eliminates the intermediary .tar.gz file and just builds the wheel once for all environments.


For verification, you can run tox -vvvvve py312 before and after.

Package installation step (before)

py312: 874 W install_package> python -I -m pip install --force-reinstall --no-deps /home/kurt/dev/pr-pypa-readme_renderer/.tox/.tmp/package/45/readme_renderer-43.0.tar.gz [tox/tox_env/api.py:425]
Processing ./.tox/.tmp/package/45/readme_renderer-43.0.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: readme_renderer
  Building wheel for readme_renderer (pyproject.toml) ... done
  Created wheel for readme_renderer: filename=readme_renderer-43.0-py3-none-any.whl size=13304 sha256=534ec0e0a66e38098ca98b4c2043c07f33557c0483c4604e8c1ad623694416c9
  Stored in directory: /home/kurt/.cache/pip/wheels/b3/1f/e0/093a05dd510eee76ab487c953f8603b49fe1ae082ce051dd60
Successfully built readme_renderer
Installing collected packages: readme_renderer
  Attempting uninstall: readme_renderer
    Found existing installation: readme_renderer 43.0
    Uninstalling readme_renderer-43.0:
      Successfully uninstalled readme_renderer-43.0
Successfully installed readme_renderer-43.0
py312: 3266 I exit 0 (2.39 seconds) /home/kurt/dev/pr-pypa-readme_renderer> python -I -m pip install --force-reinstall --no-deps /home/kurt/dev/pr-pypa-readme_renderer/.tox/.tmp/package/45/readme_renderer-43.0.tar.gz pid=103997 [tox/execute/api.py:286]

☝️ 2.39 seconds to convert the .tar.gz file to a .whl and install it

Package installation step (after)

py312: 861 W install_package> python -I -m pip install --force-reinstall --no-deps /home/kurt/dev/pr-pypa-readme_renderer/.tox/.tmp/package/46/readme_renderer-43.0-py3-none-any.whl [tox/tox_env/api.py:425]
Processing ./.tox/.tmp/package/46/readme_renderer-43.0-py3-none-any.whl
Installing collected packages: readme-renderer
  Attempting uninstall: readme-renderer
    Found existing installation: readme_renderer 43.0
    Uninstalling readme_renderer-43.0:
      Successfully uninstalled readme_renderer-43.0
Successfully installed readme-renderer-43.0
py312: 1309 I exit 0 (0.45 seconds) /home/kurt/dev/pr-pypa-readme_renderer> python -I -m pip install --force-reinstall --no-deps /home/kurt/dev/pr-pypa-readme_renderer/.tox/.tmp/package/46/readme_renderer-43.0-py3-none-any.whl pid=104486 [tox/execute/api.py:286]

☝️ 0.45 seconds to install the .whl file

@kurtmckee
Copy link
Contributor Author

Note

CI is failing, but it is unrelated to this change. The test suite fails locally prior to this change, too.

@kurtmckee
Copy link
Contributor Author

Rebased on main

@kurtmckee
Copy link
Contributor Author

Friendly reminder to take a peek at this. 😀

When running tox locally, this reduces the total test time by ~40% (from ~44 seconds to ~26 seconds):

BEFORE

  py39: OK (3.41=setup[2.66]+cmd[0.75] seconds)
  py310: OK (2.83=setup[2.04]+cmd[0.79] seconds)
  py311: OK (2.79=setup[2.04]+cmd[0.75] seconds)
  py312: OK (3.68=setup[2.17]+cmd[1.51] seconds)
  pypy39: OK (7.71=setup[3.62]+cmd[4.09] seconds)
  pypy310: OK (7.72=setup[3.65]+cmd[4.07] seconds)
  pep8: OK (0.13=setup[0.00]+cmd[0.12] seconds)
  packaging: OK (9.58=setup[2.34]+cmd[3.59,3.40,0.25] seconds)
  noextra: OK (3.60=setup[2.20]+cmd[1.40] seconds)
  mypy: OK (2.29=setup[2.18]+cmd[0.11] seconds)
  congratulations :) (43.87 seconds)

  
AFTER

  py39: OK (1.77=setup[1.03]+cmd[0.74] seconds)
  py310: OK (1.21=setup[0.40]+cmd[0.80] seconds)
  py311: OK (1.16=setup[0.40]+cmd[0.76] seconds)
  py312: OK (1.91=setup[0.43]+cmd[1.48] seconds)
  pypy39: OK (4.71=setup[0.72]+cmd[3.99] seconds)
  pypy310: OK (4.59=setup[0.73]+cmd[3.86] seconds)
  pep8: OK (0.12=setup[0.00]+cmd[0.12] seconds)
  packaging: OK (7.58=setup[0.44]+cmd[3.56,3.33,0.25] seconds)
  noextra: OK (1.78=setup[0.43]+cmd[1.35] seconds)
  mypy: OK (0.54=setup[0.43]+cmd[0.11] seconds)
  congratulations :) (25.49 seconds)

@miketheman miketheman merged commit e84ded1 into pypa:main Jul 2, 2024
8 checks passed
@kurtmckee kurtmckee deleted the create-a-wheel-once branch July 2, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants