Added poetry bit to direnv
This commit is contained in:
		
					parent
					
						
							
								fdf1ffb04e
							
						
					
				
			
			
				commit
				
					
						656ae606db
					
				
			
		
					 1 changed files with 12 additions and 0 deletions
				
			
		
							
								
								
									
										12
									
								
								dot_direnvrc
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								dot_direnvrc
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -7,3 +7,15 @@ layout_virtualenvwrapper() {
 | 
			
		|||
  local venv_path="${WORKON_HOME}/$1"
 | 
			
		||||
  layout_virtualenv $venv_path
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
layout_poetry() {
 | 
			
		||||
  if [[ ! -f pyproject.toml ]]; then
 | 
			
		||||
    log_error 'No pyproject.toml found.  Use `poetry new` or `poetry init` to create one first.'
 | 
			
		||||
    exit 2
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  local VENV=$(dirname $(poetry run which python))
 | 
			
		||||
  export VIRTUAL_ENV=$(echo "$VENV" | rev | cut -d'/' -f2- | rev)
 | 
			
		||||
  export POETRY_ACTIVE=1
 | 
			
		||||
  PATH_add "$VENV"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue