strong-toothbrush-37759
03/22/2022, 8:28 PMdjango-dotenv
to python-dotenv
and with that from absolute to relative and a-lot-easier .env
-File loading. But now my testing with Pants stopped working due to the fact (I guess) that it’s hermetic and the .env
-File cannot be found. Is there a common way to use .env
-Files inside Pants? At least I couldn’t find anything related to that topic inside the docs 🙂..env
-File like we did before? 🤓enough-analyst-54434
03/22/2022, 8:37 PMOr do I pass the absolute path to theYou generally want to avoid absolute paths with Pants if possible. Think about trying to share cache hits when using a remote cache. Likely all users will have a different absolute path for a given thing and then any action pants performs that needs that path cannot have its results shared across users.-File like we did before?.env
But now my testing with Pants stopped working due to the fact (I guess) that it’s hermetic and theYour guess is correct. You have to declare dependencies on all the files you need. We take away that trouble for code dependencies (imports) and some other things with dep inference, but-File cannot be found..env
.env
is not one of those. So you'll need a file
(s?) target to own the .env
and then you'll need to wire up a dependency on that target to everything that needs it.file
target is outlined here: https://www.pantsbuild.org/docs/reference-filestrong-toothbrush-37759
03/22/2022, 8:41 PM.env
-Files inside of PEXs? In my eyes they are basically parameters of execution. So of course they can change behavior or even the build but this is a matter of loading environment-variables.enough-analyst-54434
03/22/2022, 8:42 PMstrong-toothbrush-37759
03/22/2022, 8:44 PMenough-analyst-54434
03/22/2022, 8:45 PM.env
. This trickles into tests when we configure those env vars to leak through.strong-toothbrush-37759
03/22/2022, 8:52 PM.env
-Files rarely have Python-specific things to them. Or do you mean when you’re executing a second language from your shell, you want the Environment-Variables loaded from the start? 🤔enough-analyst-54434
03/22/2022, 8:56 PMstrong-toothbrush-37759
03/22/2022, 8:57 PMenough-analyst-54434
03/22/2022, 8:58 PMstrong-toothbrush-37759
03/22/2022, 8:59 PMhappy-kitchen-89482
03/22/2022, 9:10 PMstrong-toothbrush-37759
03/22/2022, 9:46 PM.env
file” to direnv 😄. Gonna need to explain to my devs tomorrow but this does make more sense than using 3 additional libraries. I love it! Thank you so much! And Pants is happy as well 🚀