Skip to content

✨ feat(env): add disallow_pass_env to exclude env vars - #3698

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:feat/disallow-pass-env
Feb 15, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:feat/disallow-pass-env

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

When using pass_env with wildcards like FOO_*, there was no way to exclude specific variables from the matched set. Tools where unset and empty-string have different semantics were impossible to configure correctly.

The new disallow_pass_env option accepts the same fnmatch glob patterns as pass_env and filters out matching variables after pass_env expansion, before set_env is applied. This keeps the configuration model simple — a separate key rather than overloaded syntax like !FOO in pass_env.

[env_run_base]
pass_env = ["FOO_*"]
disallow_pass_env = ["FOO_SECRET"]

Closes #1387

When using pass_env with wildcards like FOO_*, there was no way to
exclude specific variables from the match. The new disallow_pass_env
option accepts the same fnmatch glob patterns and filters out matching
variables after pass_env expansion, before set_env is applied.

Closes tox-dev#1387
@gaborbernat
gaborbernat merged commit a40b7da into tox-dev:main Feb 15, 2026
26 checks passed
@gaborbernat
gaborbernat deleted the feat/disallow-pass-env branch February 18, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tox needs an option to unset environment variables to complement passenv

1 participant