From 193ebf5d03e3ae1bb49b26f22e4e82240cabd308 Mon Sep 17 00:00:00 2001 From: Adrian Grucza Date: Sat, 26 Jul 2025 20:54:28 +1000 Subject: [PATCH 1/2] fix(python-plugin): add UV_PROJECT_ENVIRONMENT env variable --- plugins/python.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/python.json b/plugins/python.json index 25a4d654386..4e48943a48c 100644 --- a/plugins/python.json +++ b/plugins/python.json @@ -9,6 +9,9 @@ "{{ .Virtenv }}/bin/venvShellHook.sh": "python/venvShellHook.sh" }, "shell": { - "init_hook": ["{{ .Virtenv }}/bin/venvShellHook.sh"] + "init_hook": [ + "export UV_PROJECT_ENVIRONMENT=\"$VENV_DIR\"", + "{{ .Virtenv }}/bin/venvShellHook.sh" + ] } } From 4052e5f622053200523848c6f3044d5197272d58 Mon Sep 17 00:00:00 2001 From: Adrian Grucza Date: Sat, 26 Jul 2025 20:56:22 +1000 Subject: [PATCH 2/2] docs(python): correct the default virtual env dir --- docs/app/docs/devbox_examples/languages/python.md | 4 ++-- examples/development/python/pip/README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/app/docs/devbox_examples/languages/python.md b/docs/app/docs/devbox_examples/languages/python.md index 0c4aafae3d3..719f7f61d99 100644 --- a/docs/app/docs/devbox_examples/languages/python.md +++ b/docs/app/docs/devbox_examples/languages/python.md @@ -27,7 +27,7 @@ This will install Python 3.10 in your shell. You can find other versions of Pyth The `python` package automatically comes bundled with `pip`, and the `python` plugin for Devbox will automatically create a virtual environment for installing your packages locally -Your virtual environment is created in the `.devbox/virtenv/python` directory by default, and can be activated by running `. $VENV_DIR/bin/activate` in your Devbox shell. You can activate the virtual environment automatically using the init_hook of your `devbox.json`: +Your virtual environment is created in the root directory of your project by default, and can be activated by running `. $VENV_DIR/bin/activate` in your Devbox shell. You can activate the virtual environment automatically using the init_hook of your `devbox.json`: ```json { @@ -46,7 +46,7 @@ For Fish or other shells, you may need to use a different activation script. See ::: -Devbox installs the virtual environment in `.devbox/virtenv/python/.venv` by default. You can modify this path by setting the `VENV_DIR` environment variable in your devbox.json: +Devbox installs the virtual environment in `$DEVBOX_PROJECT_ROOT/.venv` by default. You can modify this path by setting the `VENV_DIR` environment variable in your devbox.json: ```json { diff --git a/examples/development/python/pip/README.md b/examples/development/python/pip/README.md index 78fec1c6762..dc5b72dd9a1 100644 --- a/examples/development/python/pip/README.md +++ b/examples/development/python/pip/README.md @@ -25,7 +25,7 @@ This will install Python 3.10 in your shell. You can find other versions of Pyth You can install `pip` by running `devbox add python3xxPackages.pip`, where `3xx` is the version of Python you want to install. This will also install the pip plugin for Devbox, which automatically creates a virtual environment for installing your packages locally -Your virtual environment is created in the `.devbox/virtenv/pip` directory by default, and can be activated by running `. $VENV_DIR/bin/activate` in your devbox shell. You can activate the virtual environment automatically using the init_hook of your `devbox.json`: +Your virtual environment is created in the root directory of your project by default, and can be activated by running `. $VENV_DIR/bin/activate` in your devbox shell. You can activate the virtual environment automatically using the init_hook of your `devbox.json`: ```json {