Always load .env file
See original GitHub issueI think it might be worth considering to always load the .env
file. As far I can see it is only loaded when running pipenv shell
.
An example use case for this would be to share the configuration of PIPENV_VENV_IN_PROJECT
so that the venv is created in the local directory. See also steps to replicate.
Describe your environment
- OS Type: Windows 10
- Python version:
$ python -V
: Python 2.7.11 - Pipenv version:
$ pipenv --version
: pipenv, version 8.2.7
Steps to replicate
Run in powershell:
PS C:\tmp\pipenv> echo "PIPENV_VENV_IN_PROJECT 1" > .env
PS C:\tmp\pipenv> cat .env
PIPENV_VENV_IN_PROJECT 1
PS C:\tmp\pipenv> pipenv --two
Expected result
.env
file is loaded, resulting in:
Virtualenv location: C:\tmp\pipenv\.venv
Actual result
.env
file is not loaded, resulting in:
Virtualenv location: C:\Users\Karim\.virtualenvs\playground-pipenv-RDyG8wOS
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to automatically load and unload .env file with variables
Is it possible to load an .env file when accessing the directory they are in and unload these variables when changing to another...
Read more >Is there a way to automatically load environment variables ...
A good practice is to use dotenv . You can load your environment by placing your environment variables into a file named .env...
Read more >Automatically Load Environment Variables in Flask
Learn how to use python dotenv to automatically load environment variables into your Flask projects.
Read more >Using .env Files for Environment Variables in Python ...
load_dotenv () will first look for a .env file and if it finds one, it will load the environment variables from the file...
Read more >Basic Features: Environment Variables - Next.js
Note: If you are using a /src folder, please note that Next.js will load the .env files only from the parent folder and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think that making
pipenv
handle.env
duringpipenv install
is a better solution thandirenv
because:pipenv
already loads.env
, so all necessary plumbing is already theredirenv
has to be installed and configured separately, wherever you want to usepipenv
- all developers’ machines, Jenkins, TravisCI etc.My personal motivation for having this functionality: I have a project that uses private PyPI that doesn’t have a shared URL - each developer has their own URL because of security concerns, so I can’t put that URL in
Pipfile
. As far as I can see, the next logical place would be to put it in.env
, but it’s not that useful when it’s not used bypipenv install
.I have the the same problem as others, need to install a package from a private repository. Having
pipenv install
using.env
would be very very useful.