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

python: use built-in venv instead of virtualenv when installing formulae #10039

Merged
merged 2 commits into from
Jan 9, 2021

Conversation

dtrodrigues
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?
  • Have you successfully run brew man locally and committed any changes?

This PR uses python's built-in venv to install formulae instead of the external virtualenv, which has dependencies and needs to be bootstrapped. The dependencies could also theoretically differ based on Python version.

Current caveat: venv uses ensurepip to install pip and setuptools using the wheels that are bundled with cpython, even if a newer one is installed, which is 20.2.3 for pip and 49.2.1 for setuptools in Python 3.9.1: https://github.com/python/cpython/blob/1e5d33e9b9b8631b36f061103a30208b206fd03a/Lib/ensurepip/__init__.py#L16-L18, https://github.com/python/cpython/tree/1e5d33e9b9b8631b36f061103a30208b206fd03a/Lib/ensurepip/_bundled

Other downstream package managers patch ensurepip to point to their locally managed pip and setuptools: https://src.fedoraproject.org/rpms/python3.9/blob/2084e749c71fe494a9a4ed76ce9c2d149b76868c/f/00189-use-rpm-wheels.patch, so that's a possible solution to ensure the temporary installation venv is using the latest versions that Homebrew knows about vs either using a known outdated version or blindly using the latest available in PyPI.

Marking as a draft for now and can look into writing new tests if it's decided to go in this direction.

Follow-up to #9435.

@BrewTestBot
Copy link
Member

Review period will end on 2020-12-17 at 17:41:06 UTC.

1 similar comment
@BrewTestBot
Copy link
Member

Review period will end on 2020-12-17 at 17:41:06 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Dec 16, 2020
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

I'd be happy to see us go in this direction. Nice work @dtrodrigues!

Library/Homebrew/test/language/python_spec.rb Outdated Show resolved Hide resolved
@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Dec 17, 2020
@BrewTestBot
Copy link
Member

Review period ended.

@MikeMcQuaid
Copy link
Member

Nice work, thanks @dtrodrigues!

@dtrodrigues dtrodrigues merged commit d75e9c9 into Homebrew:master Jan 9, 2021
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Feb 9, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Feb 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants