-
-
Save navigatingbots/37acd087a98700d90e3dc069cdec2346 to your computer and use it in GitHub Desktop.
Revisions
-
navigatingbots revised this gist
Jun 14, 2025 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,6 +18,7 @@ 1. Update `~/.zshrc` echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo 'eval "$(pyenv init --path)"' >> ~/.zshrc echo 'eval "$(pyenv init -)"' >> ~/.zshrc echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc -
ZhangChen199102 revised this gist
Apr 1, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,4 +52,4 @@ Now anytime you enter `./project_1/` or a directory under it, the virtualenv will automatically be activated, and environment variables will be setup. 6. For IDE virtualenv setup, the created virtualenv is under directory `~/.pyenv/versions/virtualenv_name/` -
Chen revised this gist
Mar 6, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ 1. Restart shell 1. Add [`.direnvrc`](https://gist.github.com/ZhangChen199102/da3133fc05e3b03afab405fdc3152fb3#file-direnvrc) under `~/` ## In use -
Chen revised this gist
Aug 17, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo 'eval "$(pyenv init -)"' >> ~/.zshrc echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc 1. Restart shell -
Chen revised this gist
Aug 16, 2021 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,12 +15,12 @@ brew install direnv 1. Update `~/.zshrc` echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo 'eval "$(pyenv init -)"' >> ~/.zshrc echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc echo 'eval "$(direnv hook bash)"' >> ~/.zshrc 1. Restart shell -
Chen revised this gist
Dec 5, 2018 . 1 changed file with 12 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,15 +33,23 @@ mkdir project_1 2. Create virtual environment: pyenv virtualenv 3.6.7 venv-name 3. Create `.python-version` under `./project_1` with the virtual environment name created in step 2. venv-name 4. Create `.envrc` under `./project_1` with environment variables declaration like: ```export ENV_VARIBALE_NAME=bla``` 5. Enter the project directory, run this command to trust current environment, you only need to run this at this first time and once `.envrc` is updated. cd projects_1/ direnv allow Now anytime you enter `./project_1/` or a directory under it, the virtualenv will automatically be activated, and environment variables will be setup. 6. For IDE virtualenv setup, the virtualenv is under `~/.pyenv/versions/virtualenv_name/` -
Chen revised this gist
Dec 5, 2018 . 2 changed files with 2 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,7 +33,8 @@ mkdir project_1 2. Create `.envrc` under `./project_1` with environment variables declaration like: `export ENV_VARIBALE_NAME=bla` 3. Enter the project directory, run this command to trust current environment, you only need to run this at this first time and once `.envrc` is updated. -
Chen renamed this gist
Feb 25, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Chen revised this gist
Feb 25, 2018 . No changes.There are no files selected for viewing
-
Chen revised this gist
Feb 25, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,8 @@ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile echo 'eval "$(direnv hook bash)"' >> ~/.bash_profile 1. Restart shell 1. Add `.direnvrc` under `~/` -
Chen revised this gist
Feb 25, 2018 . 1 changed file with 4 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,14 +16,11 @@ brew install direnv 1. Update `~/.bash_profile` echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile echo 'eval "$(pyenv init -)"' >> ~/.bash_profile echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile echo 'eval "$(direnv hook bash)"' >> ~/.bash_profile 1. Add `.direnvrc` under `~/` -
Chen revised this gist
Feb 25, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,8 @@ `echo 'eval "$(pyenv init -)"' >> ~/.bash_profile` `echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile` `echo 'eval "$(direnv hook bash)"' >> ~/.bash_profile` echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc 1. Add `.direnvrc` under `~/` -
Chen revised this gist
Feb 25, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,6 +18,7 @@ 1. Update `~/.bash_profile` `echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile` `echo 'eval "$(pyenv init -)"' >> ~/.bash_profile` `echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile` `echo 'eval "$(direnv hook bash)"' >> ~/.bash_profile` -
Chen revised this gist
Feb 25, 2018 . 4 changed files with 78 additions and 46 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,22 @@ # use a certain pyenv version use_python() { if [ -n "$(which pyenv)" ]; then local pyversion=$1 pyenv local ${pyversion} fi } layout_virtualenv() { local pyversion=$1 local pvenv=$2 if [ -n "$(which pyenv-virtualenv)" ]; then pyenv virtualenv --force --quiet ${pyversion} ${pvenv}-${pyversion} fi pyenv local --unset } layout_activate() { if [ -n "$(which pyenv)" ]; then source $PYENV_ROOT/versions/$1/bin/activate fi } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ # python version will be used for this project. pyversion=3.6.4 # virtualenv name pvenv=project1_env # use a certain pyenv version use python ${pyversion} # Create the virtualenv if not yet done layout virtualenv ${pyversion} ${pvenv} # activate it layout activate ${pvenv}-${pyversion} # add environment variable here export ENVIRONMENT_VARIABLE="first_environment_variable" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ ## Install and setup 1. Install pyenv and pyenv-virtualenv brew install pyenv brew install pyenv-virtualenv 2. Install different versions of python pyenv install 3.6.4 pyenv install 3.6.0 1. Install direnv brew install direnv 1. Update `~/.bash_profile` `echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile` `echo 'eval "$(pyenv init -)"' >> ~/.bash_profile` `echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile` `echo 'eval "$(direnv hook bash)"' >> ~/.bash_profile` 1. Add `.direnvrc` under `~/` ## In use 1. Create a project directory. mkdir project_1 2. Add `.envrc` under `./project_1` 3. Enter the project directory, run this command to trust current environment, you only need to run this at this first time and once `.envrc` is updated. cd projects_1/ direnv allow Now anytime you enter `./project_1/` or a directory under it, the virtualenv will automatically be activated, and environment variables will be setup. 4. For IDE virtualenv setup, the virtualenv is under `~/.pyenv/versions/virtualenv_name/` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,41 +0,0 @@ -
ChenZhang revised this gist
Feb 24, 2018 . 1 changed file with 41 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ ## Install 1. Install pyenv brew install pyenv 2. Install different versions of python on your machine pyenv install 3.6.4 pyenv install 3.6.0 1. Install direnv brew install direnv 1. Add the following line at the end of the ~/.bashrc file: eval "$(direnv hook bash)" 1. for other shells setup: [https://github.com/direnv/direnv#setup](https://github.com/direnv/direnv#setup) 1. Create `.direnvrc` in `~/` ## In use 1. Create a project directory. mkdir project_1 2. Create `.envrc` under `./project_1` echo "use python 3.6.4" > project_1/.envrc echo "export ENVIRONMENT_VARIABLE=1" > project_1/.envrc 3. Enter the project directory, run this command to trust current environment, you only need to run this at this first time and once `.envrc` is updated. cd projects_1/ direnv allow Now anytime you enter `./project_1/` or a directory under it, the virtualenv will automatically be setup your environment variables. -
ChenZhang created this gist
Feb 24, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ # See https://github.com/direnv/direnv/wiki/Python#-pyenv use_python() { local python_root=$HOME/.pyenv/versions/$1 load_prefix "$python_root" layout_python "$python_root/bin/python" }