Git Product home page Git Product logo

Comments (23)

kazagistar avatar kazagistar commented on July 23, 2024 8

Simple workaround: place this .env somewhere high in your directory tree (possibly in the root)

if [ -n "$VIRTUAL_ENV" ] ; then
    deactivate
fi

I am sure there are some horrible side effects I am not taking into consideration, but it works for me. <_<

from autoenv.

blueyed avatar blueyed commented on July 23, 2024 1

FYI: zsh-autoenv also supports this, either through a separate or the same file (where you can look at a variable to see which event it is).

from autoenv.

kennethreitz avatar kennethreitz commented on July 23, 2024

Yeah, I've considered this for a while, but decided it's out of scope (for now).

Thanks for the suggestions though, I'll definitely consider them in the future.

from autoenv.

kennethreitz avatar kennethreitz commented on July 23, 2024

I'll leave this issue open for discussion.

from autoenv.

honzajavorek avatar honzajavorek commented on July 23, 2024

I like the idea.

from autoenv.

JeffPaine avatar JeffPaine commented on July 23, 2024

+1

from autoenv.

Bankq avatar Bankq commented on July 23, 2024

I'd love if I can put it in .env with separate parts. Like

[load]
...
...
...

[unload]
...
...

from autoenv.

bahoo avatar bahoo commented on July 23, 2024

+1. I do see how it qualifies as out of scope, but I'd use an add-on (or completely separate) tool for handling unloading, if it existed.

from autoenv.

laithalissa avatar laithalissa commented on July 23, 2024

I do hope you change you mind about this issue, but cool project anyway.

from autoenv.

bryanjos avatar bryanjos commented on July 23, 2024

Awesome project. I would love to see this one feature added as well.

from autoenv.

blueyed avatar blueyed commented on July 23, 2024

FYI: smartcd supports this.

from autoenv.

wangyandongnx avatar wangyandongnx commented on July 23, 2024

+1 for the unload feature.

from autoenv.

msjaiswal avatar msjaiswal commented on July 23, 2024

+1

from autoenv.

unforswearing avatar unforswearing commented on July 23, 2024

+1

from autoenv.

kevinpostal avatar kevinpostal commented on July 23, 2024

+1

from autoenv.

Atry avatar Atry commented on July 23, 2024

+1

from autoenv.

luizs81 avatar luizs81 commented on July 23, 2024

+1

from autoenv.

aliavni avatar aliavni commented on July 23, 2024

+1

from autoenv.

SashaOv avatar SashaOv commented on July 23, 2024

I would suggest documenting the workaround by @kazagistar above somewhere in README. It could be useful for many people

from autoenv.

yuanbohan avatar yuanbohan commented on July 23, 2024

+1

from autoenv.

wddabc avatar wddabc commented on July 23, 2024

Hi, I'm running into the same issue and found the suggestion by @kazagistar to be very useful. Thanks.

One minor issue of that snippet is it will always run whenever I enter the subfolders, which will unnecessarily deactivate and reactivate the env.
My two cents on the improvement:

recent_env=$(pwd)
while [ "${recent_env}" != "$HOME" ];do
    if [ -f ${recent_env}/.env ];then
        return
    fi
    recent_env=$(dirname "${recent_env}")
done
source deactivate

This will make sure the source deactivate runs only when there are no other .env files along the path except the one on the $HOME.

from autoenv.

kennethreitz avatar kennethreitz commented on July 23, 2024

I recommend just using direnv for this functionality.

from autoenv.

hyperupcall avatar hyperupcall commented on July 23, 2024

Closed as this was implemented in v0.3.0. Sorry for the pings - I know this is an older thread. If you are still using autoenv, free make a new issue for bug reports / unexpected functionality.

from autoenv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.