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 { 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" + ] } }