Commit b3b09a1
committed
Add option not to override existing env variables
The reason the default behavior of this plugin is what it is, is because
it has origins during the time when there were a lot of users migrating
away from [Pipenv](https://github.com/pypa/pipenv), many switching to
Poetry. [Pipenv had built-in `.env`
loading](https://pipenv.pypa.io/en/latest/shell/#automatic-loading-of-env)
which [did override by default (and still
does)](https://github.com/pypa/pipenv/blob/98bdb5f8b2f08a435a825915d7d7d215a7aaec19/pipenv/utils/environment.py#L37).
In order to support the many people coming from `pipenv` the goal was to
make the fewest changes from that toolset possible in regards to `.env`
loading. That is also why there are other some [analogous environment
variables between this project and `pipenv` with a section about them in
the
README](https://github.com/mpeteuil/poetry-dotenv-plugin#coming-from-pipenv).
If you're coming from vanilla `python-dotenv` then this is unexpected.
That needs to be reconciled with the expectations of anyone coming from
`pipenv`. Here we add a system environment
variable—`POETRY_DOTENV_DONT_OVERRIDE`. I think it should solve most
cases. This is because most users who want it to [behave like
`python-dotenv`'s
defaults](https://github.com/theskumar/python-dotenv#getting-started)
probably want that everywhere and the same for anyone who wants it to
behave like `pipenv`.1 parent b0c573a commit b3b09a1
3 files changed
Lines changed: 54 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
59 | 99 | | |
60 | 100 | | |
61 | 101 | | |
| |||
78 | 118 | | |
79 | 119 | | |
80 | 120 | | |
| 121 | + | |
| 122 | + | |
81 | 123 | | |
0 commit comments