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

DRIVERS-3032 ensure uv is installed after venv activation #592

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

eramongodb
Copy link
Contributor

@eramongodb eramongodb commented Feb 7, 2025

Followup to #591 and #591.

Several issues appear to be related to the errors that motivated prior PRs:

  • If venv already exists, it may be activated without a call to pip install uv even if uv has not yet been installed into that venv.
  • uv may not necessarily be installed directly into venv/bin or venv/Script. It is possible for the binary to reside in a deeper subdirectory such as "site-packages", which in turn may also be within a Python-versioned subdirectory, such as "python-3.12" (given uv is designed to support multiple Python versions). The pushd $1 after activating the virtual environment may additionally break $PATH expectations (although I would expect/assume calling pip or python -m pip within an activate environment should be resiliant to this...).

Regardless, it seems sufficent to 1) ensure uv is checked and installed after activation (regardless whether the environment already existed or not, and 2) store and use the full path to the resulting binary (via which) to account for changing working directories.

@eramongodb eramongodb requested a review from blink1073 February 7, 2025 21:29
@eramongodb eramongodb self-assigned this Feb 7, 2025
@eramongodb eramongodb changed the title DRIVERS-3032 set UV_UNMANAGED_INSTALL=1 when installing uv DRIVERS-3032 ensure uv is installed after venv activation Feb 7, 2025
@eramongodb eramongodb removed the request for review from blink1073 February 7, 2025 22:03
@eramongodb eramongodb force-pushed the det-uv-install branch 4 times, most recently from a8108e5 to eb304cd Compare February 7, 2025 22:39
@blink1073
Copy link
Member

Passing with python driver, merging, thanks!

@blink1073 blink1073 marked this pull request as ready for review February 10, 2025 14:07
@blink1073 blink1073 merged commit f43767d into mongodb-labs:master Feb 10, 2025
74 checks passed
@eramongodb eramongodb deleted the det-uv-install branch February 10, 2025 19:51
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