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

Activate when entering subdirs #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

infotroph
Copy link

Current version only activates the venv when you enter the project root directory, and not if you cd directly from outside the project into a subdirectory.

This patch corrects that by checking for a pyproject.toml in the current pwd or any ancestor of it.

Current version only activates the venv when you enter the project root directory, and not if you cd directly from outside the project into a subdirectory. This patch corrects that by checking for a pyproject.toml in the current pwd or any ancestor of it.
@urbandw
Copy link

urbandw commented Sep 29, 2022

I like this change! One thing I'm noticing is that even though you can cd into a project subdir and activate the correct venv, you still have to come into a project directory from above, and cannot cd directly between projects. E.g.

Works:

cd proj1_top_dir/sub1
cd ../..
cd proj2_top_dir/sub2

Does not work:

cd proj1_top_dir/sub1
cd ../../proj2_top_dir/sub2

Or, forgetting subdirs:

Works

cd proj1_top_dir
cd ..
cd proj2_top_dir

Does not work

cd proj1_top_dir
cd ../proj2_top_dir

This is not a huge inconvenience, but seemed worth noting.

@infotroph
Copy link
Author

I and @urbandw are debugging this in another channel, and it appears the behavior he's seeing happens when moving between a Poetry project and a pyenv-virtualenv project, but not when moving between two Poetry projects. We'll report back here when we have an MRE.

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