Skip to content

fix(python plugin): remove UV_PYTHON env variable #2608

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yemaney
Copy link
Contributor

@yemaney yemaney commented May 5, 2025

Summary

Fixes: #2575

The current python plugin sets UV_PYTHON to path of python executable under default VENV_DIR directory. However if someone sets a custom VENV_DIR in their devbox.json file, this will cause an error. Since uv will attempt and fail to find python in the default VENV_DIR path where the venv would no longer exist.

This change removes the UV_PYTHON environment variable from the plugin altogether. This can be done, since uv will use the python executable of the active virtual environment its running in (https://docs.astral.sh/uv/reference/cli/#uv-python), and the venv is automatically created and activated by the python plugin.

This change allows flexibility for users to set their own VENV_DIR. It also still works with pip (uv pip install) as expected.

How was it tested?

  1. devbox create uvtest --template python-pip
  2. cd uvtest
  3. mkdir -p src/uvtest
  4. add "VENV_DIR": "./src/uvtest/.venv" to env section of devbox.json file
  5. devbox shell
  6. uv run main.py: (this step would cause an error before these changes)
  7. uv pip install fastapi

Community Contribution License

All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.

By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.

@LucilleH LucilleH requested review from mikeland73 and Copilot May 8, 2025 23:26
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the UV_PYTHON environment variable from the Python plugin configuration to prevent errors when a custom VENV_DIR is provided.

  • Removed the UV_PYTHON key from the JSON configuration.
  • Retained VENV_DIR to allow custom virtual environment paths.
Comments suppressed due to low confidence (1)

plugins/python.json:5

  • Consider adding a comment or updating the relevant documentation explaining the removal of UV_PYTHON to help other developers understand the rationale behind this change.
"UV_PYTHON": "{{ .DevboxProjectDir }}/.venv/bin/python"

@mikeland73 mikeland73 requested a review from Lagoja May 13, 2025 22:13
Copy link
Contributor

@mikeland73 mikeland73 left a comment

Choose a reason for hiding this comment

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

LGTM, but I'm less familiar with this plugin. @Lagoja PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

UV Python project is broken: No interpreter found for path
3 participants