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

"Custom" VIRTUAL_ENV for layout_python broken with source_up #960

Open
blalor opened this issue Jun 28, 2022 · 1 comment
Open

"Custom" VIRTUAL_ENV for layout_python broken with source_up #960

blalor opened this issue Jun 28, 2022 · 1 comment
Labels

Comments

@blalor
Copy link

blalor commented Jun 28, 2022

Describe the bug

#876 introduced the ability to customize the path used when creating Python virtual environments when using layout python. When used with source_up and an upper .envrc also uses layout python, the upper venv hides the lower one.

To Reproduce

setup

[~] → root=$( mktemp -d )
[~] → echo 'layout python' > "${root}/.envrc"
[~] → direnv allow "${root}"
[~] → mkdir "${root}/foo"
[~] → cat > "${root}/foo/.envrc"
source_up
layout python
[~] → direnv allow "${root}/foo"

use

[~] → cd "${root}/foo"
direnv: loading <root>/foo/.envrc
direnv: loading <root>/.envrc
direnv: export ~PATH ~VIRTUAL_ENV
[<root>/foo] → echo $VIRTUAL_ENV
<root>/.direnv/python-3.9.13

Expected behavior

echo $VIRTUAL_ENV should have returned <root>/foo/.direnv/python-3.9.13.

Putting unset VIRTUAL_ENV between source_up and layout python in <root>/foo/.envrc renders the expected behavior.

Environment

  • OS: macOS Monterey
  • Shell: zsh
  • Direnv version: 2.32.1

Additional context

Customizing the location of the virtual env is fine, but it shouldn't be using the variable set by the venv module.

@blalor blalor added the Bug label Jun 28, 2022
@Yevgnen
Copy link

Yevgnen commented Jul 1, 2022

Got a similar issue with

source_up
layout pyenv 3.8.13

in subdirectory.

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

No branches or pull requests

2 participants