You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thanks for Nox! It's a really nice change from tox, it's helping a lot with a package I'm working on that has a complicated build. Things that feel like a hack in tox are straightforward in nox.
I have a build that's unfortunately parametrized on the version of GCC, so I need to modify the PATH in a parametrized session. I've been doing
With nox 2025.2.9, this results in KeyError: 'PATH'
Expected Behavior
In nox 2024.10.9, this doesn't throw an error, and instead adds gcc_path to the front of the PATH in the session.
Steps To Reproduce
import nox
@nox.session
@nox.parametrize('gcc_path', ['/first/path', '/second/path'])
def build(session, gcc_path):
session.env['PATH'] = gcc_path + ":" + session.env['PATH']
# I would then run pyproject-build -w which would use the
# GCC version from the PATH
Unless I find a way to make the env dict smarter, session.env['PATH'] = gcc_path + ":" + os.environ['PATH'] should work. The bin paths will still be prepended when it runs correctly.
The problem is that we support session.run(include_outer_env=False), and if the outer environment PATH is already present in the session, then how can you remove it when calling session.run? While if you know you aren't going to use this, then just accessing os.environ directly is safe. See #874.
Current Behavior
Hello, thanks for Nox! It's a really nice change from tox, it's helping a lot with a package I'm working on that has a complicated build. Things that feel like a hack in tox are straightforward in nox.
I have a build that's unfortunately parametrized on the version of GCC, so I need to modify the PATH in a parametrized session. I've been doing
With nox 2025.2.9, this results in
KeyError: 'PATH'
Expected Behavior
In nox 2024.10.9, this doesn't throw an error, and instead adds
gcc_path
to the front of the PATH in the session.Steps To Reproduce
Environment
Anything else?
Is there some other way that I should be doing this? Like should I copy
os.environ['PATH']
in?The text was updated successfully, but these errors were encountered: