Skip to content

direnv and venv segments #386

@v1gnesh

Description

@v1gnesh

Say I have this directory structure:

py-pandas/
py-pandas/.envrc
py-pandas/.direnv
py-pandas/.direnv/venv-de

venv-de is a directory created by running python -m venv venv-de from inside py-pandas.

I'm using direnv, and have both direnv and venv modules in the powerline-go prompt.
When I cd into py-pandas, I see the direnv segment, and it activates the venv ok (confirmed by running python -c "import sys;print(sys.prefix). It prints <blabla>/py-pandas/.direnv/venv-de.

Then, from py-pandas directory, when I do mv .direnv/venv-de .direnv/venv-do, the venv segment magically shows up.
Of course, by now the venv is "broken" and I'm not "in" it.

direnv and venv segments work ok in a faster machine (arch s390x)I have access to.
I should note that the above problem is on a zOS system (same architecture, different OS) that is quite slow (small).

So I wonder if there's a timing issue.

Both direnv and powerline-go updates the $PROMPT_COMMAND, and am using bash.
powerline-go sets it to PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND", but then direnv also updates this.
When I issue echo $PROMPT_COMMAND (while the venv segment shows the venv's name, but I've renamed the venv directory underneath it), this is what it says - _update_ps1; _direnv_hook.

Anything I can do to make this work?
It would be amazing if the direnv segment automatically shows info about the activated env (be it python or whatever else), by wrapping over powerline-go's venv, etc.
Seeing just the directory name again is not adding much value (direnv segment).

Shell: bash
OS: zOS

Thanks for this excellent, excellent tool. I'm really enjoying it ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions