Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] add option to allow UV_ENV_FILE to point to non-existing file #9270

Open
WouterJTB opened this issue Nov 20, 2024 · 3 comments
Labels
needs-decision Undecided if this should be done

Comments

@WouterJTB
Copy link

Problem

I'd like to be able to do the following:

export UV_ENV_FILE=./.env
uv run <something>
cd <new repo without .env file>
uv run <something>

or even better, add export UV_ENV_FILE=./.env to my .bash_profile

Currently, uv will throw an error if UV_ENV_FILE doesn't point to a valid file:

error: No environment file found at: `./.env`

Proposed solution

Add a config option/env var to proceed on missing env file, e.g. proceed with uv run (and throw a warning instead) if UV_WARN_ON_MISSING_ENV_FILE=1.

Alternatively, maybe there's a solution where a missing env-file is only an error if it's passed with the --env-file flag, and a warning if it's set with the UV_ENV_FILE var.

@pszpetkowski
Copy link

I've stumbled upon a similar problem. Imo it would be great to just have a flag (or even default behavior) to read .env in the project directory if such file exists.

@charliermarsh charliermarsh added the needs-decision Undecided if this should be done label Nov 22, 2024
@charliermarsh
Copy link
Member

What's the use-case that you're trying to accomplish? You want .env to be read always, and ignore errors if it doesn't exist?

@WouterJTB
Copy link
Author

WouterJTB commented Nov 22, 2024

Essentially, yes. There's generally some env vars that I source centrally (i.e. artifactory/docker login credentials), and some that I have in a .env file in the repo (i.e. db connection strings, mlflow tracking uri etc.), I can't really store them centrally because the apps/libs generally look for specific var names to find and connect to the resources.

I'd like to be able to configure uv to use my repo scoped .env files (if found) by default, without breaking my development workflow if I switch to another repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision Undecided if this should be done
Projects
None yet
Development

No branches or pull requests

3 participants