Comments (23)
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.
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.
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.
I'll leave this issue open for discussion.
from autoenv.
I like the idea.
from autoenv.
+1
from autoenv.
I'd love if I can put it in .env
with separate parts. Like
[load]
...
...
...
[unload]
...
...
from autoenv.
+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.
I do hope you change you mind about this issue, but cool project anyway.
from autoenv.
Awesome project. I would love to see this one feature added as well.
from autoenv.
FYI: smartcd supports this.
from autoenv.
+1 for the unload feature.
from autoenv.
+1
from autoenv.
+1
from autoenv.
+1
from autoenv.
+1
from autoenv.
+1
from autoenv.
+1
from autoenv.
I would suggest documenting the workaround by @kazagistar above somewhere in README. It could be useful for many people
from autoenv.
+1
from autoenv.
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.
I recommend just using direnv for this functionality.
from autoenv.
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)
- Is the pypi version not catching up?
- Created by mistake - ignore me
- brew version is outdated. HOT 1
- Odd behavior with nvm installed HOT 3
- Broken image ref in the README
- sourcing of activate.sh on OSx Big Sur causes hanging in Terminal HOT 3
- Git installation instructions are outdated HOT 1
- Ability to not override `cd` on source
- Properly use shelltest
- Uninstall autoenv - Mac OS Ventura 13.0 HOT 2
- Error bash: 1: No such file or directory HOT 3
- Add autoenv AUR package
- Error with nvm on Mac HOT 2
- Autoenv keep asking for permission HOT 5
- autoenv_check_authz_and_run:7: read-only variable: status HOT 1
- autoenv running on all directories in parent HOT 1
- Document usable varaibles in `.env` file
- Transfer repo back to @kennethreitz HOT 2
- Source parent directory's `.env.leave` file when leaving subdirectory
- Error when entering or leaving a project with .env or .env.leave file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autoenv.