Skip to content

Add .env file support for environment login strategy#1265

Open
Sherwin-14 wants to merge 1 commit intoearthaccess-dev:mainfrom
Sherwin-14:env
Open

Add .env file support for environment login strategy#1265
Sherwin-14 wants to merge 1 commit intoearthaccess-dev:mainfrom
Sherwin-14:env

Conversation

@Sherwin-14
Copy link
Copy Markdown
Contributor

@Sherwin-14 Sherwin-14 commented Mar 22, 2026

This PR allows the environment login strategy to load environment variables from .env file. Resolves #748.


📚 Documentation preview 📚: https://earthaccess--1265.org.readthedocs.build/en/1265/

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 22, 2026

Binder 👈 Launch a binder notebook on this branch for commit 904e65b

I will automatically update this comment whenever this PR is modified

Binder 👈 Launch a binder notebook on this branch for commit 5589720

@jhkennedy
Copy link
Copy Markdown
Contributor

jhkennedy commented Mar 23, 2026

I feel like I've missed some conversations here, but I'm not sure we should add load_dotenv to the earthaccess init.

It looks like this is only being used for earthdata login credentials, and a netrc file is a more standard place to serialize and store the credentials, which we'll also write to disk for users. I'm not sure what benefit supporting .dotenv adds and makes reasoning about credentials more complicated?

Similarly, I've typically seen .env use more for testing than for end-users, so I would have expected to see this in a conftest.py or similar.

@Sherwin-14
Copy link
Copy Markdown
Contributor Author

Sherwin-14 commented Mar 23, 2026 via email

@chuckwondo
Copy link
Copy Markdown
Contributor

I agree with @jhkennedy.

Although dotenv is a small package, our dependency tree is already quite bloated (we should define "extras" to help end-users avoid unwanted deps).

Further, this approach does not allow users to configure things differently than the default (i.e., this approach supports only use of a single file named .env).

If a user wants to use a "dot env" file, they should do so on their own so they have full control.

@chuckwondo
Copy link
Copy Markdown
Contributor

I agree with @jhkennedy.

Although dotenv is a small package, our dependency tree is already quite bloated (we should define "extras" to help end-users avoid unwanted deps).

Further, this approach does not allow users to configure things differently than the default (i.e., this approach supports only use of a single file named .env).

If a user wants to use a "dot env" file, they should do so on their own so they have full control.

I suppose this is more of a downvote for the original issue: #748

@Sherwin-14
Copy link
Copy Markdown
Contributor Author

Sherwin-14 commented Mar 25, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable getting envvars from .env file

3 participants