Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pipenv and bash aliases

I have a core set of bash aliases defined in my .bash_profile (Mac). But when I activate a pipenv with pipenv shell, my aliases don't work and the bash alias command returns nothing.

Is there a configuration step needed to spawn pipenv shells that inherit bash aliases from the parent shell?

like image 902
shacker Avatar asked Sep 26 '17 00:09

shacker


People also ask

Can you use aliases in bash script?

Bash Alias allows to aggregate multiple functions into a single command and also it avoids repetitive or large commands into a simple shortcut command. BASH Alias is a map of shortcut command with the sets of commands which are stored in a file called either . bash_profile or . bashrc with a specific syntax.

Where do I put bash aliases?

You need to put bash shell aliases in the ~/. bashrc file ($HOME/. bashrc) file executed by bash for non-login shells. On most modern Linux distros, you may want to put all your bash alias definitions into a separate file like ~/.

What does Pipenv shell do?

Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip , virtualenv , and the good old requirements. txt . In addition to addressing some common issues, it consolidates and simplifies the development process to a single command line tool.

How do you run Pipenv?

To activate the environment, just navigate to your project directory and use pipenv shell to launch a new shell session or use pipenv run <command> to run a command directly.


1 Answers

Aliases are never inherited. .bash_profile is only sourced for login shells, and pipenv apparently creates a nonlogin interactive shell. Aliases should be defined in .bashrc, and on a Mac (where terminal emulators starts login shells by default), add [[ -f ~/.bashrc ]] && source ~/.bashrc to the end of your .bash_profile.

like image 107
chepner Avatar answered Sep 22 '22 04:09

chepner