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

include_outer_env=False will include outer_env when env is not set #868

Open
Wurstnase opened this issue Oct 15, 2024 · 3 comments · May be fixed by #874
Open

include_outer_env=False will include outer_env when env is not set #868

Wurstnase opened this issue Oct 15, 2024 · 3 comments · May be fixed by #874
Labels

Comments

@Wurstnase
Copy link
Contributor

Current Behavior

On include_outer_env=False, all outer environment variable will be used, when env is not set or None.

Expected Behavior

When include_outer_env=False, no environment variables should be set. Also when no env is set.
Current workaround is env={}

Steps To Reproduce

import nox

@nox.session
def env(session: Session):
    session.run("printenv", include_outer_env=False)
    session.run("printenv", include_outer_env=False, env={})

Environment

- OS: MacOS 15
- Python: 3.12.7
- Nox: 2024.4.15

Anything else?

No response

@Wurstnase Wurstnase added the bug label Oct 15, 2024
@henryiii
Copy link
Collaborator

Actually, I think there's a second bug. I believe VIRTUAL_ENV and CONDA_PREFIX don't get set if you use this option, as well.

@henryiii henryiii linked a pull request Oct 27, 2024 that will close this issue
@Wurstnase
Copy link
Contributor Author

tox1 do a lot of magic to pass the correct values.

Should nox stay this clean way?

Maybe some more configurable?

include_outer_env: Literal["all", "recommended", "none"]

while recommended will pass a similar list of environment variables like in tox.

e.g. on my setup I need to set HOME again, otherwise it wouldn't find my .netrc with the credentials for a private pypi repository.

Footnotes

  1. https://github.com/tox-dev/tox/blob/08f2ac55d67b1ca91e56e61fb09d6f7d7034ef2a/src/tox/tox_env/api.py#L204

@henryiii
Copy link
Collaborator

henryiii commented Nov 8, 2024

This is a separate issue (nox isn't even setting its own variables when include_outer_env is false, like VIRTUAL_ENV). But not a bad (separate) idea.

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

Successfully merging a pull request may close this issue.

2 participants